Html5 circle looks horrible when rotate

Don’t know if this topic was discussed before. I can’t find something similar.
Problem is when I am drawing a circle and rotating it , it looks horrible, I have tried to compile in flash and it looks just fine but html5 is causing the problem,

sun = new Sprite();,0xFF6600);;,0,40);;
addEventListener(Event.ENTER_FRAME, orbit);
private function orbit(e):Void 

Notice that orange and blue both circle are kinda cut off , and when they rotate they are kinda shaky.

I can’t help with the weird shapes.

Try opening this class: openfl/xxx/openfl/_internal/renderer/canvas/CanvasRenderer.hx (I think your target is HTML5 canvas), and change

renderSession.roundPixels = true;


renderSession.roundPixels = false;

This should eliminate the stuttering rotations forever.
Same story for the other renderers.

Hi GiG.

I ran into the same problem as Galib a while back:
Unfortunately no one ever replied. I just looked at CanvasRenderer.hx
and GLRenderer.hx and you know what? With OpenFL 4.9.1 renderSession.roundPixels
seems to be false by default. This ain’t giving me smooth rotations though.
Could you do me a favor and check the code snippet in the post I’ve linked
and tell me if it’s looking smooth?


Nevermind GiG.

I just did some testing and found out that renderSession.roundPixels actually affects the smoothness of
a rotation. The object to be rotated needs to be a Bitmap though and furthermore it’s smoothing property
should be set to true. If it’s a simple shape as in my example above the rotation will be stuttering no
matter what you do.

@Galib - Try this workaround:


import openfl.display.Sprite;
import openfl.display.Shape;
import openfl.display.Bitmap;
import openfl.display.BitmapData;
import openfl.Lib;
import openfl.geom.Matrix;

class Main extends Sprite 
    private var sun:Sprite = new Sprite();
    public function new() 
        var shape = new Shape();,0xFF6600);;,0,40);;
        var bmpData:BitmapData = new BitmapData(Math.ceil(shape.width)+1, Math.ceil(shape.height)+1, true, 0x00ff00);
        var mat:Matrix = new Matrix();
        mat.translate(bmpData.width / 2, bmpData.height / 2);
        var bmp:Bitmap = new Bitmap(bmpData);
        bmp.smoothing = true;
        bmp.x -= bmp.width / 2;
        bmp.y -= bmp.height / 2;
        sun.x = sun.y = 100;
        addEventListener(Event.ENTER_FRAME, orbit);
    private function orbit(e):Void

This will help with the rotation - the cropped look remains though.