简体   繁体   English

设置变换原点属性X和Y坐标

[英]Set transform origin property X and Y coordinates

Set transform origin property X and Y coordinates struggling to set transform origin property from javascript for both axis. 设置转换原点属性X和Y坐标时遇到困难,因此无法通过JavaScript为两个轴设置转换原点属性。

so from javascript: object.style.transformOrigin = valueX valueY; 所以从javascript: object.style.transformOrigin = valueX valueY;

Unfortunately, it doesnt work... if i set 2 values it doesnt work.. if i set only 1 value, the valueX is changed only. 不幸的是,它不起作用...如果我设置2个值,它将不起作用..如果我仅设置1个值,则valueX仅会更改。

What i have done: 我做了什么:

newClasses.style.transformOrigin = scaleOrigPoint + "px"; // sets only for valueX
newClasses.style.transformOrigin = (scaleOrigPoint + "px") + (scaleOrigPointY + "px"); // sets only for valueY
newClasses.style.transformOrigin = (scaleOrigPoint + "px") , (scaleOrigPointY + "px"); // doesnt set anything + ERROR
newClasses.style.transformOrigin = (scaleOrigPoint + "px") (scaleOrigPointY + "px"); // doesnt set anything + ERROR
newClasses.style.transformOrigin = [scaleOrigPoint]px; // doesnt set anything + ERROR

And many many other ways... Somethimes it changes the valueY only... 还有许多其他方式...某些东西仅改变了值Y ...

Question: 题:

Is there a way to set bot valueX and valueY for transform origin property using javascript only ? 有没有一种方法可以使用javascript将bot valueX和valueY设置为变换原点属性?

您是否尝试过在它们之间留出空间?

newClasses.style.transformOrigin = scaleOrigPoint + "px " + scaleOrigPointY + "px";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在变换和变换原点之后计算新的(x,y)坐标? - Calculate new (x, y) coordinates after transform & transform-origin? 一个简单的笛卡尔平面,用于X和Y坐标,原点位于中心 - A simple Cartesian plane for X and Y coordinates and the origin point being at the center 将(旋转的)ImageOverlay中的X和Y坐标转换为纬度和经度 - Transform X and Y coordinates inside a (rotated) ImageOverlay to latitude and longitude Fabric JS:使用坐标(x,y)设置图像定位 - Fabric JS: Set Image positioning with coordinates (x,y) 如何为角色移动设置(x,y)坐标的限制 - how to set the limits of (x,y) coordinates for the character movement html canvas为mouseup事件设置x和y坐标 - html canvas set x and y coordinates for mouseup events 给定一组 x 和 y 坐标,得到 javascript 中的曲线方程 - get the equation of a curve in javascript given a set of x and y coordinates 如何为树内的每个id设置坐标(x,y) - how to set coordinates (x,y) for each id inside the tree 如何设置 FabricJS 图像的 4 个角 X、Y 坐标值 - How to set the 4 corners X, Y coordinates value of a FabricJS image 如何在d3版本4中获得相对于元素原点的(x,y)坐标 - How to get the (x, y)-coordinates relative to an element's origin in d3 VERSION 4
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM