JavaScript Truly rotate center of equilateral triangle in Fabric.js

Using Fabric.js, I'm having trouble truly rotating a triangle around its center point, or at least what I believe should be the center point. I created a jsFiddle that demonstrates. The triangle is simple, and I used originX: 'center' and the same for originY, however as the triangle is rotating, there is still slight movement in the x and y directions. How do I make sure that the triangle never moves?

I found this answer and was wondering if this is the right path to take? how to rotate around one specified point in fabric.js?

EDIT: New efforts include implementing the answer from the above linked question. Here's the code:

function createTriangle(x, y, angle)
{

    var t = new fabric.Triangle(
    {
        width: 350,
        height: 300,
        selectable: false,
        fill: 'rgba(0,0,0,0)',
        stroke: 'white',
        strokeWidth: 2,
        left: x,
        top: y,
        angle: angle
    });


    var rotation_origin = new fabric.Point(t.getCenterPoint().x, t.getCenterPoint().y);
    var angle_randians = fabric.util.degreesToRadians(angle);
    var rotatePoint = fabric.util.rotatePoint(new fabric.Point(rotation_origin.x, rotation_origin.y), rotation_origin, angle_randians);

    t.originX = rotatePoint.x;
    t.originY = rotatePoint.y;  
    return t;`
}

This, however is not working for me. The triangle still moves a bit while rotating.

EDIT: I tried setting the specified rotation points from the linked question above. It hasn't worked for me. The triangle rotates exactly the same.

EDIT2: As I dive more into this, I'm starting to believe this is more than a Fabric.js question. It seems like more webGL, but not an issue, just the way shapes are transformed. I can see that there is a difference between rotating a rectangle and a triangle. Using center origins, rectangles always never appear to move around. I have not found the answer but I'm including webGL as a tag to hopefully get some help on this. Has anyone ever encountered this?

Answer:1

I have seen many answers in stack overflow which says setting response headers will make you "CORS" request.But no solution worked for me.I have written the following code: //Server.js Code var ...

I have seen many answers in stack overflow which says setting response headers will make you "CORS" request.But no solution worked for me.I have written the following code: //Server.js Code var ...

  1. making cors request with fetch
  2. making cors request in angularjs
  3. make cors request
  4. make cors request javascript
  5. make cors request ajax
  6. make cors request axios
  7. make cors request in postman
  8. make cors request online
  9. make cors request react
  10. make cors request from chrome
  11. making a cors request with jquery
  12. angular make cors request
  13. js make cors request
  14. curl make cors request
  15. vue make cors request
  16. reactjs make cors request

I ask for for some help since I can't find another thread to resolve my problem. I'm using HighCharts to render one chart with temperature and humidity values, saved on a local database. Each values ...

I ask for for some help since I can't find another thread to resolve my problem. I'm using HighCharts to render one chart with temperature and humidity values, saved on a local database. Each values ...

  1. highcharts multiple series line chart
  2. highcharts multiple series json
  3. highcharts multiple series in one chart
  4. highcharts multiple series bar chart
  5. highcharts multiple series tooltip
  6. highcharts multiple series line
  7. highcharts multiple series drilldown
  8. highcharts multiple series column chart
  9. highcharts multiple series types
  10. highcharts multiple series color
  11. highcharts multiple series
  12. highcharts multiple series example
  13. highcharts multiple series y axis
  14. highcharts multiple series data array
  15. highcharts multiple series categories
  16. highcharts multiple series x axis
  17. highcharts multiple series pie chart
  18. highcharts multiple series legend
  19. highcharts multiple series in navigator
  20. multiple series name highcharts

I have the following page <!DOCTYPE html> <html> <script type="text/javascript"> function loopLink(i) { window.open($('#iframe_a').contents().find('.image-...

I have the following page <!DOCTYPE html> <html> <script type="text/javascript"> function loopLink(i) { window.open($('#iframe_a').contents().find('.image-...

My app works fine on browser but doesn't render the google map on emulator. This app is based on an exisiting app that already has a google map working fine on emulator (and device) I think because ...

My app works fine on browser but doesn't render the google map on emulator. This app is based on an exisiting app that already has a google map working fine on emulator (and device) I think because ...

  1. google maps working offline
  2. google maps working out distance
  3. google maps working slow
  4. google maps working principle
  5. google maps working without data
  6. google maps working
  7. google maps working without internet
  8. google maps working in china
  9. google maps working in airplane mode
  10. google maps not working
  11. google maps not working on iphone
  12. google maps not working android
  13. google maps not working properly
  14. google maps stopped working
  15. google maps not working on iphone 6
  16. google maps not working 2019
  17. google maps not working in chrome
  18. google maps not working on pc
  19. google maps isn't working
  20. google maps not working 2018