css-transforms

Javascript: matrix operations for CSS transform perspective

喜夏-厌秋 提交于 2019-12-04 15:51:33
I'm using this script that claims to implement matrix3d operation as described in the spec , however the script is missing matrix perspective operations, so I "cooked" something I'm not sure is either accurate or correct. // the perspective matrix to multiply with CSSMatrix.Perspective = function(x, y, z){ var m = new CSSMatrix(); m.m13 = x; m.m23 = y; m.m33 = z; return m; }; and the method to use this matrix // myMatrix.perspective(x,y,z); to apply a perspective matrix CSSMatrix.prototype.perspective = function(x, y, z){ if (y == null) y = 0; if (z == null) z = 0; return CSSMatrix.multiply

How can I wrap a container around its css-transformed contents?

余生长醉 提交于 2019-12-04 14:57:48
When I use scale or rotate , the parent element wraps to the size of the pre-translation dimensions of the element. JSFiddle Example Is there any way to wrap the parent container around the bounding box of the transformed element with CSS, or do I need to use Maths to manually position things? Matthew Green Based on this earlier question it sounds like you will need to use some math and javascript to change the wrapper. By using the function in the answer you could then set the wrapper dimensions based on the dimensions you just calculated. 来源: https://stackoverflow.com/questions/14246982/how

How to flip multiple divs using CSS?

好久不见. 提交于 2019-12-04 12:52:41
How can I flip multiple div 's when I clicked on menus using CSS3? This code is working for only the last two div s : HTML Code <ul class="nav"> <li><a href="#home">home</a></li> <li><a href="#about">about</a></li> <li><a href="#work">work</a></li> <li><a href="#contact">contact</a></li> </ul> <section class="container"> <div id="card"> <div class="front flipper" id="home">home</div> <div class="back flipper" id="about">about</div> <div class="front flipper" id="work">work</div> <div class="back flipper" id="contact">contact</div> </div> </section> CSS Code .container { width: 500px; height:

Div elements to follow a curved path with CSS3

此生再无相见时 提交于 2019-12-04 08:41:39
So the basic idea is 1 - 9 seats at a curved table as though you are looking at them through first person view. I'm trying to get div elements which would be seats to flow on the outside of another div element that has a border radius to make it a semi oblong circle. I've found a few examples with an element being animated to flow across the container in an arc, but I will need the div/seats to be static. I am looking for any ideas or examples that can lead me in the right path. Finding points on ellipse and translating: If your oblong circle resembles an ellipse then you can find points on

Is the CSS3 transform translate percentage values relative to its width and/or height?

风格不统一 提交于 2019-12-04 08:20:33
I think it is true that when we do a CSS3 transform translate using a percentage value, then that percentage is relative to its own width or height, so (50%, 75%) means 50% of its own width, 75% of its own height, but I can't find any specs that say that. Example: https://jsfiddle.net/cstsyw3s/1/ using: transform: translate(100%, 100%) I looked into http://www.w3.org/TR/css3-transforms but can't find it mentioned there -- I could only find such as for transform-origin , the "percentages: refer to the size of bounding box", and I think the bounding box probably is rectangle with the element's

How to reverse-engineer a webkit matrix3d transform

好久不见. 提交于 2019-12-04 06:25:57
I've got a cube element being rotated and translated in a 3d space. I want to find out just the rotateY portion of this transform at a given time. Is this possible? I have: var cube = document.getElementById("cube"); var transform = getComputedStyle(cube).webkitTransform; //the value of transform is: // matrix3d(-1, 0, 0.00000000000000012246467991473532, 0, // 0, 1, 0, 0, // -0.00000000000000012246467991473532, 0, -1, 0, // 0, 0, 0, 1) Help? :-) If your object is only being rotated about Y, then yes, the rotation is simple to calculate - it's the arccos of Matrix elements 1,1 or 3,3 or the

Detect if computer can support 3D Transforms properly

橙三吉。 提交于 2019-12-04 06:09:43
问题 When I detect webkit, I add an additionnal stylesheet using 3D Transforms properties. Although it is working fine on many different computers (All on the same chrome version) , some don't render the animation properly. Those are older computers with cheaper Graphic Card. (I guess that is what is causing the problem.) Is there a better way to detect if a computer can handle Css 3D Transforms than rely on the browser detection? 回答1: Use Modernizr and its csstransforms3d class name. More on

Why doesn't IE10 display nested CSS3 3D transformed elements?

蓝咒 提交于 2019-12-04 05:55:34
i'm a bit lost here, i'm currently testing the IE10 (10.0.9200.16384) that came with the Windows 8 Release Preview, and i'm having a very hard time. One of the things that are bugging me, is that IE doesn't seem to handle nested 3D Transforms corrently. Please see this fiddle: http://jsfiddle.net/uUHdF/1/ There are two colored divs, a red one, and a green one rotated and translated so that it acts as the top of a cuboid, and this cuboid itself is rotated and translated too (note that i can't use transform-origin with rotate only because it is/was buggy in Webkit... just in case that might be

CSS transform animation crashes

大城市里の小女人 提交于 2019-12-04 05:16:29
问题 I have an issue but can't find where I made a mistake... I made an little animation using transform in CSS as you can see on the code. But sometimes when I hover the mouse the animation becomes crazy. I feel like it occurs often when I hover from bottom left to right. Wonder is you can see it. Can you help me fix it please ? *{ box-sizing: border-box; } body{ margin: 0; padding: 0; background: #ccc; } .container{ width: 400px; margin: 0 auto; margin-top: 200px; position: relative; } .carre{

translate3d between 0% and negative % in IE10

醉酒当歌 提交于 2019-12-04 04:53:25
I have an element that needs to animate left and right to the amount of 50% of its full width. I've accomplished this with the following (simplified) markup: <div class="wrapper"> <div class="inner">Inner</div> </div> And style: .wrapper { position: relative; width: 300px; height: 200px; } .inner { position: absolute; top: 0; right: 0; bottom: 0; left: 0; animation: MOVE_AROUND 5s infinite; } With keyframe animation: @keyframes MOVE_AROUND { 0%, 10% { transform: translate3d(0, 0, 0); } 20%, 40% { transform: translate3d(-50%, 0, 0); } 60%, 80% { transform: translate3d(50%, 0, 0); } 90%, 100% {