Transforms and Transitions | Canvas, SVG and Drag and Drop ||WDD330📱

Transform

The transform property lets you translate, rotate, scale adn skew any element on the page. Examples as follows:

Transitions

The transitions functions allow you to move elements left and right, up or down. These funcitons are similarto the behavior of possitionL relative in CSS. The translate(x,y) function moves an element x from the left, and y from the top: transform: translate(45px, -45px); Examples as follows:

Keyframes

Example of simple animation

@keyframes moveRight {
from {
transform: translateX(-50%);
}
to {
transform: translateX(50%);
}
}

@keyframes appearDisappear {
0%, 100% {
opacity: 0;
}
20%, 80% {
opacity: 1;
}
}

@keyframes bgMove {
100% {
background-position: 120% 0;
}
}

@keyframes x {
//transform
}

Canvas

The Canvas is used to draw anything we can imagen and manipulate the screen and modify the DOM. to use Canvas you need to use the tag canvas.

HTML

canvas id="myCanvas" class="myCanvas" width="200" height="200" Sorry! Your browser doesn’t support Canvas. /canvas

CSS

.myCanvas { border: dotted 2px black; }

JS

var canvas = document.getElementById("myCanvas");

Team Assignment

code picture code picture code picture

Reference

https://www.sitepoint.com/premium/books/html5-css3-for-the-real-world-2nd-edition/read/12/

Contact me

📧Email me at iodaniel@byui.edu