Hyperscript
In your next assignment, you are going to apply a variable rotation to the flying saucer.
Because hyperscript is a pure JavaScript function, you have easy access to variables while rendering markup.
In our application we are going to use the style
attribute to control the flying saucer.
Attributes can be set on virtual DOM nodes using the properties
parameter of the h()
function.
The full signature of the h()
function is:
function h(selector, properties, children) // returns a virtual node object
Parameters
- selector CSS selector containing the tagname, id and fixed css classnames
- properties Object literal containing element attributes and some other special properties.
- children Array of childnodes and text strings
Example:
h("a", {href: "/"}, ["Home"])
The objective of your next assignment is to set the style
attribute to "transform:rotate(45deg)"
.
You must use the provided variable rotation to construct the value.
Press next to start. Good luck.