Web UI for ARGUS server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

7362 lines
163 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Shape</title>
  6. <base target="class-frame">
  7. <link href="../assets/css/docs.css" rel="stylesheet" type="text/css">
  8. <script src="../assets/js/paper.js"></script>
  9. <script src="../assets/js/jquery.js"></script>
  10. <script src="../assets/js/codemirror.js"></script>
  11. <script src="../assets/js/docs.js"></script>
  12. </head>
  13. <body>
  14. <article class="reference">
  15. <div class="reference-class">
  16. <h1>Shape</h1>
  17. <p> Extends <b><a href="../classes/Item.html"><tt>Item</tt></a></b></p>
  18. </div>
  19. <!-- =============================== constructors ========================== -->
  20. <div class="reference-members">
  21. <h2>Constructors</h2>
  22. <div id="shape-circle-center-radius" class="member">
  23. <div class="member-link">
  24. <a name="shape-circle-center-radius" href="#shape-circle-center-radius"><tt><b>Shape.Circle</b>(center, radius)</tt></a>
  25. </div>
  26. <div class="member-description hidden">
  27. <div class="member-text">
  28. <p>Creates a circular shape item.</p>
  29. <ul class="member-list">
  30. <h4>Parameters:</h4>
  31. <li>
  32. <tt>center:</tt>
  33. <a href="../classes/Point.html"><tt>Point</tt></a>
  34. &mdash;&nbsp;the center point of the circle
  35. </li>
  36. <li>
  37. <tt>radius:</tt>
  38. <tt>Number</tt>
  39. &mdash;&nbsp;the radius of the circle
  40. </li>
  41. </ul>
  42. <ul class="member-list">
  43. <h4>Returns:</h4>
  44. <li>
  45. <tt><a href="../classes/Shape.html"><tt>Shape</tt></a></tt>&nbsp;&mdash;&nbsp;the newly created shape
  46. </li>
  47. </ul>
  48. <h4>Example:</h4>
  49. <div class="paperscript split">
  50. <div class="buttons">
  51. <div class="button run">Run</div>
  52. </div>
  53. <script type="text/paperscript" canvas="canvas-0">
  54. var shape = new Shape.Circle(new Point(80, 50), 30);
  55. shape.strokeColor = 'black';
  56. </script>
  57. <div class="canvas"><canvas width="516" height="100" id="canvas-0"></canvas></div>
  58. </div>
  59. </div>
  60. </div>
  61. </div>
  62. <div id="shape-circle-object" class="member">
  63. <div class="member-link">
  64. <a name="shape-circle-object" href="#shape-circle-object"><tt><b>Shape.Circle</b>(object)</tt></a>
  65. </div>
  66. <div class="member-description hidden">
  67. <div class="member-text">
  68. <p>Creates a circular shape item from the properties described by an object literal.</p>
  69. <ul class="member-list">
  70. <h4>Parameters:</h4>
  71. <li>
  72. <tt>object:</tt>
  73. <tt>Object</tt>
  74. &mdash;&nbsp;an object containing properties describing the shape&rsquo;s attributes
  75. </li>
  76. </ul>
  77. <ul class="member-list">
  78. <h4>Returns:</h4>
  79. <li>
  80. <tt><a href="../classes/Shape.html"><tt>Shape</tt></a></tt>&nbsp;&mdash;&nbsp;the newly created shape
  81. </li>
  82. </ul>
  83. <h4>Example:</h4>
  84. <div class="paperscript split">
  85. <div class="buttons">
  86. <div class="button run">Run</div>
  87. </div>
  88. <script type="text/paperscript" canvas="canvas-1">
  89. var shape = new Shape.Circle({
  90. center: [80, 50],
  91. radius: 30,
  92. strokeColor: 'black'
  93. });
  94. </script>
  95. <div class="canvas"><canvas width="516" height="100" id="canvas-1"></canvas></div>
  96. </div>
  97. </div>
  98. </div>
  99. </div>
  100. <div id="shape-rectangle-rectangle" class="member">
  101. <div class="member-link">
  102. <a name="shape-rectangle-rectangle" href="#shape-rectangle-rectangle"><tt><b>Shape.Rectangle</b>(rectangle[, radius])</tt></a>
  103. </div>
  104. <div class="member-description hidden">
  105. <div class="member-text">
  106. <p>Creates a rectangular shape item, with optionally rounded corners.</p>
  107. <ul class="member-list">
  108. <h4>Parameters:</h4>
  109. <li>
  110. <tt>rectangle:</tt>
  111. <a href="../classes/Rectangle.html"><tt>Rectangle</tt></a>
  112. &mdash;&nbsp;the rectangle object describing the geometry of the rectangular shape to be created
  113. </li>
  114. <li>
  115. <tt>radius:</tt>
  116. <a href="../classes/Size.html"><tt>Size</tt></a>
  117. &mdash;&nbsp;the size of the rounded corners
  118. &mdash;&nbsp;optional, default: <tt>null</tt>
  119. </li>
  120. </ul>
  121. <ul class="member-list">
  122. <h4>Returns:</h4>
  123. <li>
  124. <tt><a href="../classes/Shape.html"><tt>Shape</tt></a></tt>&nbsp;&mdash;&nbsp;the newly created shape
  125. </li>
  126. </ul>
  127. <h4>Example:</h4>
  128. <div class="paperscript split">
  129. <div class="buttons">
  130. <div class="button run">Run</div>
  131. </div>
  132. <script type="text/paperscript" canvas="canvas-2">
  133. var rectangle = new Rectangle(new Point(20, 20), new Size(60, 60));
  134. var shape = new Shape.Rectangle(rectangle);
  135. shape.strokeColor = 'black';
  136. </script>
  137. <div class="canvas"><canvas width="516" height="100" id="canvas-2"></canvas></div>
  138. </div>
  139. <h4>Example:<span class="description">The same, with rounder corners</span></h4>
  140. <div class="paperscript split">
  141. <div class="buttons">
  142. <div class="button run">Run</div>
  143. </div>
  144. <script type="text/paperscript" canvas="canvas-3">
  145. var rectangle = new Rectangle(new Point(20, 20), new Size(60, 60));
  146. var cornerSize = new Size(10, 10);
  147. var shape = new Shape.Rectangle(rectangle, cornerSize);
  148. shape.strokeColor = 'black';
  149. </script>
  150. <div class="canvas"><canvas width="516" height="100" id="canvas-3"></canvas></div>
  151. </div>
  152. </div>
  153. </div>
  154. </div>
  155. <div id="shape-rectangle-point-size" class="member">
  156. <div class="member-link">
  157. <a name="shape-rectangle-point-size" href="#shape-rectangle-point-size"><tt><b>Shape.Rectangle</b>(point, size)</tt></a>
  158. </div>
  159. <div class="member-description hidden">
  160. <div class="member-text">
  161. <p>Creates a rectangular shape item from a point and a size object.</p>
  162. <ul class="member-list">
  163. <h4>Parameters:</h4>
  164. <li>
  165. <tt>point:</tt>
  166. <a href="../classes/Point.html"><tt>Point</tt></a>
  167. &mdash;&nbsp;the rectangle&rsquo;s top-left corner.
  168. </li>
  169. <li>
  170. <tt>size:</tt>
  171. <a href="../classes/Size.html"><tt>Size</tt></a>
  172. &mdash;&nbsp;the rectangle&rsquo;s size.
  173. </li>
  174. </ul>
  175. <ul class="member-list">
  176. <h4>Returns:</h4>
  177. <li>
  178. <tt><a href="../classes/Shape.html"><tt>Shape</tt></a></tt>&nbsp;&mdash;&nbsp;the newly created shape
  179. </li>
  180. </ul>
  181. <h4>Example:</h4>
  182. <div class="paperscript split">
  183. <div class="buttons">
  184. <div class="button run">Run</div>
  185. </div>
  186. <script type="text/paperscript" canvas="canvas-4">
  187. var point = new Point(20, 20);
  188. var size = new Size(60, 60);
  189. var shape = new Shape.Rectangle(point, size);
  190. shape.strokeColor = 'black';
  191. </script>
  192. <div class="canvas"><canvas width="516" height="100" id="canvas-4"></canvas></div>
  193. </div>
  194. </div>
  195. </div>
  196. </div>
  197. <div id="shape-rectangle-from-to" class="member">
  198. <div class="member-link">
  199. <a name="shape-rectangle-from-to" href="#shape-rectangle-from-to"><tt><b>Shape.Rectangle</b>(from, to)</tt></a>
  200. </div>
  201. <div class="member-description hidden">
  202. <div class="member-text">
  203. <p>Creates a rectangular shape item from the passed points. These do not necessarily need to be the top left and bottom right corners, the constructor figures out how to fit a rectangle between them.</p>
  204. <ul class="member-list">
  205. <h4>Parameters:</h4>
  206. <li>
  207. <tt>from:</tt>
  208. <a href="../classes/Point.html"><tt>Point</tt></a>
  209. &mdash;&nbsp;the first point defining the rectangle
  210. </li>
  211. <li>
  212. <tt>to:</tt>
  213. <a href="../classes/Point.html"><tt>Point</tt></a>
  214. &mdash;&nbsp;the second point defining the rectangle
  215. </li>
  216. </ul>
  217. <ul class="member-list">
  218. <h4>Returns:</h4>
  219. <li>
  220. <tt><a href="../classes/Shape.html"><tt>Shape</tt></a></tt>&nbsp;&mdash;&nbsp;the newly created shape
  221. </li>
  222. </ul>
  223. <h4>Example:</h4>
  224. <div class="paperscript split">
  225. <div class="buttons">
  226. <div class="button run">Run</div>
  227. </div>
  228. <script type="text/paperscript" canvas="canvas-5">
  229. var from = new Point(20, 20);
  230. var to = new Point(80, 80);
  231. var shape = new Shape.Rectangle(from, to);
  232. shape.strokeColor = 'black';
  233. </script>
  234. <div class="canvas"><canvas width="516" height="100" id="canvas-5"></canvas></div>
  235. </div>
  236. </div>
  237. </div>
  238. </div>
  239. <div id="shape-rectangle-object" class="member">
  240. <div class="member-link">
  241. <a name="shape-rectangle-object" href="#shape-rectangle-object"><tt><b>Shape.Rectangle</b>(object)</tt></a>
  242. </div>
  243. <div class="member-description hidden">
  244. <div class="member-text">
  245. <p>Creates a rectangular shape item from the properties described by an object literal.</p>
  246. <ul class="member-list">
  247. <h4>Parameters:</h4>
  248. <li>
  249. <tt>object:</tt>
  250. <tt>Object</tt>
  251. &mdash;&nbsp;an object containing properties describing the shape&rsquo;s attributes
  252. </li>
  253. </ul>
  254. <ul class="member-list">
  255. <h4>Returns:</h4>
  256. <li>
  257. <tt><a href="../classes/Shape.html"><tt>Shape</tt></a></tt>&nbsp;&mdash;&nbsp;the newly created shape
  258. </li>
  259. </ul>
  260. <h4>Example:</h4>
  261. <div class="paperscript split">
  262. <div class="buttons">
  263. <div class="button run">Run</div>
  264. </div>
  265. <script type="text/paperscript" canvas="canvas-6">
  266. var shape = new Shape.Rectangle({
  267. point: [20, 20],
  268. size: [60, 60],
  269. strokeColor: 'black'
  270. });
  271. </script>
  272. <div class="canvas"><canvas width="516" height="100" id="canvas-6"></canvas></div>
  273. </div>
  274. <h4>Example:</h4>
  275. <div class="paperscript split">
  276. <div class="buttons">
  277. <div class="button run">Run</div>
  278. </div>
  279. <script type="text/paperscript" canvas="canvas-7">
  280. var shape = new Shape.Rectangle({
  281. from: [20, 20],
  282. to: [80, 80],
  283. strokeColor: 'black'
  284. });
  285. </script>
  286. <div class="canvas"><canvas width="516" height="100" id="canvas-7"></canvas></div>
  287. </div>
  288. <h4>Example:</h4>
  289. <div class="paperscript split">
  290. <div class="buttons">
  291. <div class="button run">Run</div>
  292. </div>
  293. <script type="text/paperscript" canvas="canvas-8">
  294. var shape = new Shape.Rectangle({
  295. rectangle: {
  296. topLeft: [20, 20],
  297. bottomRight: [80, 80]
  298. },
  299. strokeColor: 'black'
  300. });
  301. </script>
  302. <div class="canvas"><canvas width="516" height="100" id="canvas-8"></canvas></div>
  303. </div>
  304. <h4>Example:</h4>
  305. <div class="paperscript split">
  306. <div class="buttons">
  307. <div class="button run">Run</div>
  308. </div>
  309. <script type="text/paperscript" canvas="canvas-9">
  310. var shape = new Shape.Rectangle({
  311. topLeft: [20, 20],
  312. bottomRight: [80, 80],
  313. radius: 10,
  314. strokeColor: 'black'
  315. });
  316. </script>
  317. <div class="canvas"><canvas width="516" height="100" id="canvas-9"></canvas></div>
  318. </div>
  319. </div>
  320. </div>
  321. </div>
  322. <div id="shape-ellipse-rectangle" class="member">
  323. <div class="member-link">
  324. <a name="shape-ellipse-rectangle" href="#shape-ellipse-rectangle"><tt><b>Shape.Ellipse</b>(rectangle)</tt></a>
  325. </div>
  326. <div class="member-description hidden">
  327. <div class="member-text">
  328. <p>Creates an elliptical shape item.</p>
  329. <ul class="member-list">
  330. <h4>Parameters:</h4>
  331. <li>
  332. <tt>rectangle:</tt>
  333. <a href="../classes/Rectangle.html"><tt>Rectangle</tt></a>
  334. &mdash;&nbsp;the rectangle circumscribing the ellipse
  335. </li>
  336. </ul>
  337. <ul class="member-list">
  338. <h4>Returns:</h4>
  339. <li>
  340. <tt><a href="../classes/Shape.html"><tt>Shape</tt></a></tt>&nbsp;&mdash;&nbsp;the newly created shape
  341. </li>
  342. </ul>
  343. <h4>Example:</h4>
  344. <div class="paperscript split">
  345. <div class="buttons">
  346. <div class="button run">Run</div>
  347. </div>
  348. <script type="text/paperscript" canvas="canvas-10">
  349. var rectangle = new Rectangle(new Point(20, 20), new Size(180, 60));
  350. var shape = new Shape.Ellipse(rectangle);
  351. shape.fillColor = 'black';
  352. </script>
  353. <div class="canvas"><canvas width="516" height="100" id="canvas-10"></canvas></div>
  354. </div>
  355. </div>
  356. </div>
  357. </div>
  358. <div id="shape-ellipse-object" class="member">
  359. <div class="member-link">
  360. <a name="shape-ellipse-object" href="#shape-ellipse-object"><tt><b>Shape.Ellipse</b>(object)</tt></a>
  361. </div>
  362. <div class="member-description hidden">
  363. <div class="member-text">
  364. <p>Creates an elliptical shape item from the properties described by an object literal.</p>
  365. <ul class="member-list">
  366. <h4>Parameters:</h4>
  367. <li>
  368. <tt>object:</tt>
  369. <tt>Object</tt>
  370. &mdash;&nbsp;an object containing properties describing the shape&rsquo;s attributes
  371. </li>
  372. </ul>
  373. <ul class="member-list">
  374. <h4>Returns:</h4>
  375. <li>
  376. <tt><a href="../classes/Shape.html"><tt>Shape</tt></a></tt>&nbsp;&mdash;&nbsp;the newly created shape
  377. </li>
  378. </ul>
  379. <h4>Example:</h4>
  380. <div class="paperscript split">
  381. <div class="buttons">
  382. <div class="button run">Run</div>
  383. </div>
  384. <script type="text/paperscript" canvas="canvas-11">
  385. var shape = new Shape.Ellipse({
  386. point: [20, 20],
  387. size: [180, 60],
  388. fillColor: 'black'
  389. });
  390. </script>
  391. <div class="canvas"><canvas width="516" height="100" id="canvas-11"></canvas></div>
  392. </div>
  393. <h4>Example:<span class="description">Placing by center and radius</span></h4>
  394. <div class="paperscript split">
  395. <div class="buttons">
  396. <div class="button run">Run</div>
  397. </div>
  398. <script type="text/paperscript" canvas="canvas-12">
  399. var shape = new Shape.Ellipse({
  400. center: [110, 50],
  401. radius: [90, 30],
  402. fillColor: 'black'
  403. });
  404. </script>
  405. <div class="canvas"><canvas width="516" height="100" id="canvas-12"></canvas></div>
  406. </div>
  407. </div>
  408. </div>
  409. </div>
  410. </div>
  411. <!-- ================================ properties =========================== -->
  412. <div class="reference-members">
  413. <h2>Properties</h2>
  414. <div id="type" class="member">
  415. <div class="member-link">
  416. <a name="type" href="#type"><tt><b>type</b></tt></a>
  417. </div>
  418. <div class="member-description hidden">
  419. <div class="member-text">
  420. <p>The type of shape of the item as a string.</p>
  421. <ul class="member-list">
  422. <h4>Type:</h4>
  423. <li>
  424. <tt>String</tt>
  425. </li>
  426. </ul>
  427. </div>
  428. </div>
  429. </div>
  430. <div id="size" class="member">
  431. <div class="member-link">
  432. <a name="size" href="#size"><tt><b>size</b></tt></a>
  433. </div>
  434. <div class="member-description hidden">
  435. <div class="member-text">
  436. <p>The size of the shape.</p>
  437. <ul class="member-list">
  438. <h4>Type:</h4>
  439. <li>
  440. <a href="../classes/Size.html"><tt>Size</tt></a>
  441. </li>
  442. </ul>
  443. </div>
  444. </div>
  445. </div>
  446. <div id="radius" class="member">
  447. <div class="member-link">
  448. <a name="radius" href="#radius"><tt><b>radius</b></tt></a>
  449. </div>
  450. <div class="member-description hidden">
  451. <div class="member-text">
  452. <p>The radius of the shape, as a number if it is a circle, or a size object for ellipses and rounded rectangles.</p>
  453. <ul class="member-list">
  454. <h4>Type:</h4>
  455. <li>
  456. <tt>Number</tt>⟋<a href="../classes/Size.html"><tt>Size</tt></a>
  457. </li>
  458. </ul>
  459. </div>
  460. </div>
  461. </div>
  462. </div>
  463. <!-- ============================== methods ================================ -->
  464. <div class="reference-members">
  465. <h2>Methods</h2>
  466. <div id="topath" class="member">
  467. <div class="member-link">
  468. <a name="topath" href="#topath"><tt><b>toPath</b>([insert])</tt></a>
  469. </div>
  470. <div class="member-description hidden">
  471. <div class="member-text">
  472. <p>Creates a new path item with same geometry as this shape item, and inherits all settings from it, similar to <a href="../classes/Item.html#clone"><tt>item.clone</tt></a>().</p>
  473. <ul class="member-list">
  474. <h4>Parameters:</h4>
  475. <li>
  476. <tt>insert:</tt>
  477. <tt>Boolean</tt>
  478. &mdash;&nbsp;specifies whether the new path should be inserted into the scene graph. When set to <code>true</code>, it is inserted above the shape item
  479. &mdash;&nbsp;optional, default: <tt>true</tt>
  480. </li>
  481. </ul>
  482. <ul class="member-list">
  483. <h4>Returns:</h4>
  484. <li>
  485. <tt><a href="../classes/Path.html"><tt>Path</tt></a></tt>&nbsp;&mdash;&nbsp;the newly created path item with the same geometry as this shape item
  486. </li>
  487. </ul>
  488. <ul class="member-list">
  489. <h4>See also:</h4>
  490. <li><tt><a href="../classes/Path.html#toshape-insert"><tt>path.toShape(insert)</tt></a></tt></li>
  491. </ul>
  492. </div>
  493. </div>
  494. </div>
  495. </div>
  496. <!-- =========================== inherited properties ====================== -->
  497. <div class="reference-members"><h2>Properties inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
  498. <div id="id" class="member">
  499. <div class="member-link">
  500. <a name="id" href="#id"><tt><b>id</b></tt></a>
  501. </div>
  502. <div class="member-description hidden">
  503. <div class="member-text">
  504. <p>The unique id of the item.</p>
  505. <p>Read only.</p>
  506. <ul class="member-list">
  507. <h4>Type:</h4>
  508. <li>
  509. <tt>Number</tt>
  510. </li>
  511. </ul>
  512. </div>
  513. </div>
  514. </div>
  515. <div id="classname" class="member">
  516. <div class="member-link">
  517. <a name="classname" href="#classname"><tt><b>className</b></tt></a>
  518. </div>
  519. <div class="member-description hidden">
  520. <div class="member-text">
  521. <p>The class name of the item as a string.</p>
  522. <ul class="member-list">
  523. <h4>Values:</h4>
  524. <li><tt>'Group'</tt>, <tt>'Layer'</tt>, <tt>'Path'</tt>, <tt>'CompoundPath'</tt>, <tt>'Shape'</tt>, <tt>'Raster'</tt>, <tt>'SymbolItem'</tt>, <tt>'PointText'</tt></li>
  525. </ul>
  526. <ul class="member-list">
  527. <h4>Type:</h4>
  528. <li>
  529. <tt>String</tt>
  530. </li>
  531. </ul>
  532. </div>
  533. </div>
  534. </div>
  535. <div id="name" class="member">
  536. <div class="member-link">
  537. <a name="name" href="#name"><tt><b>name</b></tt></a>
  538. </div>
  539. <div class="member-description hidden">
  540. <div class="member-text">
  541. <p>The name of the item. If the item has a name, it can be accessed by name through its parent&rsquo;s children list.</p>
  542. <ul class="member-list">
  543. <h4>Type:</h4>
  544. <li>
  545. <tt>String</tt>
  546. </li>
  547. </ul>
  548. <h4>Example:</h4>
  549. <div class="paperscript split">
  550. <div class="buttons">
  551. <div class="button run">Run</div>
  552. </div>
  553. <script type="text/paperscript" canvas="canvas-13">
  554. var path = new Path.Circle({
  555. center: [80, 50],
  556. radius: 35
  557. });
  558. // Set the name of the path:
  559. path.name = 'example';
  560. // Create a group and add path to it as a child:
  561. var group = new Group();
  562. group.addChild(path);
  563. // The path can be accessed by name:
  564. group.children['example'].fillColor = 'red';
  565. </script>
  566. <div class="canvas"><canvas width="516" height="100" id="canvas-13"></canvas></div>
  567. </div>
  568. </div>
  569. </div>
  570. </div>
  571. <div id="style" class="member">
  572. <div class="member-link">
  573. <a name="style" href="#style"><tt><b>style</b></tt></a>
  574. </div>
  575. <div class="member-description hidden">
  576. <div class="member-text">
  577. <p>The path style of the item.</p>
  578. <ul class="member-list">
  579. <h4>Type:</h4>
  580. <li>
  581. <a href="../classes/Style.html"><tt>Style</tt></a>
  582. </li>
  583. </ul>
  584. <h4>Example:<span class="description">Applying several styles to an item in one go, by passing an object to its style property:</span></h4>
  585. <div class="paperscript split">
  586. <div class="buttons">
  587. <div class="button run">Run</div>
  588. </div>
  589. <script type="text/paperscript" canvas="canvas-14">
  590. var circle = new Path.Circle({
  591. center: [80, 50],
  592. radius: 30
  593. });
  594. circle.style = {
  595. fillColor: 'blue',
  596. strokeColor: 'red',
  597. strokeWidth: 5
  598. };
  599. </script>
  600. <div class="canvas"><canvas width="516" height="100" id="canvas-14"></canvas></div>
  601. </div>
  602. <h4>Example:<span class="description">Copying the style of another item:</span></h4>
  603. <div class="paperscript split">
  604. <div class="buttons">
  605. <div class="button run">Run</div>
  606. </div>
  607. <script type="text/paperscript" canvas="canvas-15">
  608. var path = new Path.Circle({
  609. center: [50, 50],
  610. radius: 30,
  611. fillColor: 'red'
  612. });
  613. var path2 = new Path.Circle({
  614. center: new Point(180, 50),
  615. radius: 20
  616. });
  617. // Copy the path style of path:
  618. path2.style = path.style;
  619. </script>
  620. <div class="canvas"><canvas width="516" height="100" id="canvas-15"></canvas></div>
  621. </div>
  622. <h4>Example:<span class="description">Applying the same style object to multiple items:</span></h4>
  623. <div class="paperscript split">
  624. <div class="buttons">
  625. <div class="button run">Run</div>
  626. </div>
  627. <script type="text/paperscript" canvas="canvas-16">
  628. var myStyle = {
  629. fillColor: 'red',
  630. strokeColor: 'blue',
  631. strokeWidth: 4
  632. };
  633. var path = new Path.Circle({
  634. center: [50, 50],
  635. radius: 30
  636. });
  637. path.style = myStyle;
  638. var path2 = new Path.Circle({
  639. center: new Point(150, 50),
  640. radius: 20
  641. });
  642. path2.style = myStyle;
  643. </script>
  644. <div class="canvas"><canvas width="516" height="100" id="canvas-16"></canvas></div>
  645. </div>
  646. </div>
  647. </div>
  648. </div>
  649. <div id="locked" class="member">
  650. <div class="member-link">
  651. <a name="locked" href="#locked"><tt><b>locked</b></tt></a>
  652. </div>
  653. <div class="member-description hidden">
  654. <div class="member-text">
  655. <p>Specifies whether the item is locked. When set to <code>true</code>, item interactions with the mouse are disabled.</p>
  656. <ul class="member-list">
  657. <h4>Default:</h4>
  658. <li><tt>false</tt></li>
  659. </ul>
  660. <ul class="member-list">
  661. <h4>Type:</h4>
  662. <li>
  663. <tt>Boolean</tt>
  664. </li>
  665. </ul>
  666. <h4>Example:</h4>
  667. <div class="paperscript split">
  668. <div class="buttons">
  669. <div class="button run">Run</div>
  670. </div>
  671. <script type="text/paperscript" canvas="canvas-17">
  672. var unlockedItem = new Path.Circle({
  673. center: view.center - [35, 0],
  674. radius: 30,
  675. fillColor: 'springgreen',
  676. onMouseDown: function() {
  677. this.fillColor = Color.random();
  678. }
  679. });
  680. var lockedItem = new Path.Circle({
  681. center: view.center + [35, 0],
  682. radius: 30,
  683. fillColor: 'crimson',
  684. locked: true,
  685. // This event won't be triggered because the item is locked.
  686. onMouseDown: function() {
  687. this.fillColor = Color.random();
  688. }
  689. });
  690. new PointText({
  691. content: 'Click on both circles to see which one is locked.',
  692. point: view.center - [0, 35],
  693. justification: 'center'
  694. });
  695. </script>
  696. <div class="canvas"><canvas width="516" height="100" id="canvas-17"></canvas></div>
  697. </div>
  698. </div>
  699. </div>
  700. </div>
  701. <div id="visible" class="member">
  702. <div class="member-link">
  703. <a name="visible" href="#visible"><tt><b>visible</b></tt></a>
  704. </div>
  705. <div class="member-description hidden">
  706. <div class="member-text">
  707. <p>Specifies whether the item is visible. When set to <code>false</code>, the item won&rsquo;t be drawn.</p>
  708. <ul class="member-list">
  709. <h4>Default:</h4>
  710. <li><tt>true</tt></li>
  711. </ul>
  712. <ul class="member-list">
  713. <h4>Type:</h4>
  714. <li>
  715. <tt>Boolean</tt>
  716. </li>
  717. </ul>
  718. <h4>Example:<span class="description">Hiding an item:</span></h4>
  719. <div class="paperscript split">
  720. <div class="buttons">
  721. <div class="button run">Run</div>
  722. </div>
  723. <script type="text/paperscript" canvas="canvas-18">
  724. var path = new Path.Circle({
  725. center: [50, 50],
  726. radius: 20,
  727. fillColor: 'red'
  728. });
  729. // Hide the path:
  730. path.visible = false;
  731. </script>
  732. <div class="canvas"><canvas width="516" height="100" id="canvas-18"></canvas></div>
  733. </div>
  734. </div>
  735. </div>
  736. </div>
  737. <div id="blendmode" class="member">
  738. <div class="member-link">
  739. <a name="blendmode" href="#blendmode"><tt><b>blendMode</b></tt></a>
  740. </div>
  741. <div class="member-description hidden">
  742. <div class="member-text">
  743. <p>The blend mode with which the item is composited onto the canvas. Both the standard canvas compositing modes, as well as the new CSS blend modes are supported. If blend-modes cannot be rendered natively, they are emulated. Be aware that emulation can have an impact on performance.</p>
  744. <ul class="member-list">
  745. <h4>Values:</h4>
  746. <li><tt>'normal'</tt>, <tt>'multiply'</tt>, <tt>'screen'</tt>, <tt>'overlay'</tt>, <tt>'soft-light'</tt>, <tt>'hard-
  747. light'</tt>, <tt>'color-dodge'</tt>, <tt>'color-burn'</tt>, <tt>'darken'</tt>, <tt>'lighten'</tt>, <tt>'difference'</tt>, <tt>'exclusion'</tt>, <tt>'hue'</tt>, <tt>'saturation'</tt>, <tt>'luminosity'</tt>, <tt>'color'</tt>, <tt>'add'</tt>, <tt>'subtract'</tt>, <tt>'average'</tt>, <tt>'pin-light'</tt>, <tt>'negation'</tt>, <tt>'source-over'</tt>, <tt>'source-in'</tt>, <tt>'source-out'</tt>, <tt>'source-atop'</tt>, <tt>'destination-over'</tt>, <tt>'destination-in'</tt>, <tt>'destination-out'</tt>, <tt>'destination-atop'</tt>, <tt>'lighter'</tt>, <tt>'darker'</tt>, <tt>'copy'</tt>, <tt>'xor'</tt></li>
  748. </ul>
  749. <ul class="member-list">
  750. <h4>Default:</h4>
  751. <li><tt>'normal'</tt></li>
  752. </ul>
  753. <ul class="member-list">
  754. <h4>Type:</h4>
  755. <li>
  756. <tt>String</tt>
  757. </li>
  758. </ul>
  759. <h4>Example:<span class="description">Setting an item's blend mode:</span></h4>
  760. <div class="paperscript split">
  761. <div class="buttons">
  762. <div class="button run">Run</div>
  763. </div>
  764. <script type="text/paperscript" canvas="canvas-19">
  765. // Create a white rectangle in the background
  766. // with the same dimensions as the view:
  767. var background = new Path.Rectangle(view.bounds);
  768. background.fillColor = 'white';
  769. var circle = new Path.Circle({
  770. center: [80, 50],
  771. radius: 35,
  772. fillColor: 'red'
  773. });
  774. var circle2 = new Path.Circle({
  775. center: new Point(120, 50),
  776. radius: 35,
  777. fillColor: 'blue'
  778. });
  779. // Set the blend mode of circle2:
  780. circle2.blendMode = 'multiply';
  781. </script>
  782. <div class="canvas"><canvas width="516" height="100" id="canvas-19"></canvas></div>
  783. </div>
  784. </div>
  785. </div>
  786. </div>
  787. <div id="opacity" class="member">
  788. <div class="member-link">
  789. <a name="opacity" href="#opacity"><tt><b>opacity</b></tt></a>
  790. </div>
  791. <div class="member-description hidden">
  792. <div class="member-text">
  793. <p>The opacity of the item as a value between <code>0</code> and <code>1</code>.</p>
  794. <ul class="member-list">
  795. <h4>Default:</h4>
  796. <li><tt>1</tt></li>
  797. </ul>
  798. <ul class="member-list">
  799. <h4>Type:</h4>
  800. <li>
  801. <tt>Number</tt>
  802. </li>
  803. </ul>
  804. <h4>Example:<span class="description">Making an item 50% transparent:</span></h4>
  805. <div class="paperscript split">
  806. <div class="buttons">
  807. <div class="button run">Run</div>
  808. </div>
  809. <script type="text/paperscript" canvas="canvas-20">
  810. var circle = new Path.Circle({
  811. center: [80, 50],
  812. radius: 35,
  813. fillColor: 'red'
  814. });
  815. var circle2 = new Path.Circle({
  816. center: new Point(120, 50),
  817. radius: 35,
  818. fillColor: 'blue',
  819. strokeColor: 'green',
  820. strokeWidth: 10
  821. });
  822. // Make circle2 50% transparent:
  823. circle2.opacity = 0.5;
  824. </script>
  825. <div class="canvas"><canvas width="516" height="100" id="canvas-20"></canvas></div>
  826. </div>
  827. </div>
  828. </div>
  829. </div>
  830. <div id="selected" class="member">
  831. <div class="member-link">
  832. <a name="selected" href="#selected"><tt><b>selected</b></tt></a>
  833. </div>
  834. <div class="member-description hidden">
  835. <div class="member-text">
  836. <p>Specifies whether the item is selected. This will also return <code>true</code> for <a href="../classes/Group.html"><tt>Group</tt></a> items if they are partially selected, e.g. groups containing selected or partially selected paths.</p>
  837. <p>Paper.js draws the visual outlines of selected items on top of your project. This can be useful for debugging, as it allows you to see the construction of paths, position of path curves, individual segment points and bounding boxes of symbol and raster items.</p>
  838. <ul class="member-list">
  839. <h4>Default:</h4>
  840. <li><tt>false</tt></li>
  841. </ul>
  842. <ul class="member-list">
  843. <h4>Type:</h4>
  844. <li>
  845. <tt>Boolean</tt>
  846. </li>
  847. </ul>
  848. <ul class="member-list">
  849. <h4>See also:</h4>
  850. <li><tt><a href="../classes/Project.html#selecteditems"><tt>project.selectedItems</tt></a></tt></li>
  851. <li><tt><a href="../classes/Segment.html#selected"><tt>segment.selected</tt></a></tt></li>
  852. <li><tt><a href="../classes/Curve.html#selected"><tt>curve.selected</tt></a></tt></li>
  853. <li><tt><a href="../classes/Point.html#selected"><tt>point.selected</tt></a></tt></li>
  854. </ul>
  855. <h4>Example:<span class="description">Selecting an item:</span></h4>
  856. <div class="paperscript split">
  857. <div class="buttons">
  858. <div class="button run">Run</div>
  859. </div>
  860. <script type="text/paperscript" canvas="canvas-21">
  861. var path = new Path.Circle({
  862. center: [80, 50],
  863. radius: 35
  864. });
  865. path.selected = true; // Select the path
  866. </script>
  867. <div class="canvas"><canvas width="516" height="100" id="canvas-21"></canvas></div>
  868. </div>
  869. </div>
  870. </div>
  871. </div>
  872. <div id="clipmask" class="member">
  873. <div class="member-link">
  874. <a name="clipmask" href="#clipmask"><tt><b>clipMask</b></tt></a>
  875. </div>
  876. <div class="member-description hidden">
  877. <div class="member-text">
  878. <p>Specifies whether the item defines a clip mask. This can only be set on paths and compound paths, and only if the item is already contained within a clipping group.</p>
  879. <ul class="member-list">
  880. <h4>Default:</h4>
  881. <li><tt>false</tt></li>
  882. </ul>
  883. <ul class="member-list">
  884. <h4>Type:</h4>
  885. <li>
  886. <tt>Boolean</tt>
  887. </li>
  888. </ul>
  889. </div>
  890. </div>
  891. </div>
  892. <div id="data" class="member">
  893. <div class="member-link">
  894. <a name="data" href="#data"><tt><b>data</b></tt></a>
  895. </div>
  896. <div class="member-description hidden">
  897. <div class="member-text">
  898. <p>A plain javascript object which can be used to store arbitrary data on the item.</p>
  899. <ul class="member-list">
  900. <h4>Type:</h4>
  901. <li>
  902. <tt>Object</tt>
  903. </li>
  904. </ul>
  905. <h4>Example:</h4>
  906. <pre><code>var path = new Path();
  907. path.data.remember = 'milk';</code></pre>
  908. <h4>Example:</h4>
  909. <pre><code>var path = new Path();
  910. path.data.malcolm = new Point(20, 30);
  911. console.log(path.data.malcolm.x); // 20</code></pre>
  912. <h4>Example:</h4>
  913. <pre><code>var path = new Path();
  914. path.data = {
  915. home: 'Omicron Theta',
  916. found: 2338,
  917. pets: ['Spot']
  918. };
  919. console.log(path.data.pets.length); // 1</code></pre>
  920. <h4>Example:</h4>
  921. <pre><code>var path = new Path({
  922. data: {
  923. home: 'Omicron Theta',
  924. found: 2338,
  925. pets: ['Spot']
  926. }
  927. });
  928. console.log(path.data.pets.length); // 1</code></pre>
  929. </div>
  930. </div>
  931. </div>
  932. <h3>Position and Bounding Boxes</h3>
  933. <div id="position" class="member">
  934. <div class="member-link">
  935. <a name="position" href="#position"><tt><b>position</b></tt></a>
  936. </div>
  937. <div class="member-description hidden">
  938. <div class="member-text">
  939. <p>The item&rsquo;s position within the parent item&rsquo;s coordinate system. By default, this is the <a href="../classes/Rectangle.html#center"><tt>rectangle.center</tt></a> of the item&rsquo;s <a href="../classes/Item.html#bounds"><tt>bounds</tt></a> rectangle.</p>
  940. <ul class="member-list">
  941. <h4>Type:</h4>
  942. <li>
  943. <a href="../classes/Point.html"><tt>Point</tt></a>
  944. </li>
  945. </ul>
  946. <h4>Example:<span class="description">Changing the position of a path:</span></h4>
  947. <div class="paperscript split">
  948. <div class="buttons">
  949. <div class="button run">Run</div>
  950. </div>
  951. <script type="text/paperscript" canvas="canvas-22">
  952. // Create a circle at position { x: 10, y: 10 }
  953. var circle = new Path.Circle({
  954. center: new Point(10, 10),
  955. radius: 10,
  956. fillColor: 'red'
  957. });
  958. // Move the circle to { x: 20, y: 20 }
  959. circle.position = new Point(20, 20);
  960. // Move the circle 100 points to the right and 50 points down
  961. circle.position += new Point(100, 50);
  962. </script>
  963. <div class="canvas"><canvas width="516" height="100" id="canvas-22"></canvas></div>
  964. </div>
  965. <h4>Example:<span class="description">Changing the x coordinate of an item's position:</span></h4>
  966. <div class="paperscript split">
  967. <div class="buttons">
  968. <div class="button run">Run</div>
  969. </div>
  970. <script type="text/paperscript" canvas="canvas-23">
  971. // Create a circle at position { x: 20, y: 20 }
  972. var circle = new Path.Circle({
  973. center: new Point(20, 20),
  974. radius: 10,
  975. fillColor: 'red'
  976. });
  977. // Move the circle 100 points to the right
  978. circle.position.x += 100;
  979. </script>
  980. <div class="canvas"><canvas width="516" height="100" id="canvas-23"></canvas></div>
  981. </div>
  982. </div>
  983. </div>
  984. </div>
  985. <div id="pivot" class="member">
  986. <div class="member-link">
  987. <a name="pivot" href="#pivot"><tt><b>pivot</b></tt></a>
  988. </div>
  989. <div class="member-description hidden">
  990. <div class="member-text">
  991. <p>The item&rsquo;s pivot point specified in the item coordinate system, defining the point around which all transformations are hinging. This is also the reference point for <a href="../classes/Item.html#position"><tt>position</tt></a>. By default, it is set to <code>null</code>, meaning the <a href="../classes/Rectangle.html#center"><tt>rectangle.center</tt></a> of the item&rsquo;s <a href="../classes/Item.html#bounds"><tt>bounds</tt></a> rectangle is used as pivot.</p>
  992. <ul class="member-list">
  993. <h4>Default:</h4>
  994. <li><tt>null</tt></li>
  995. </ul>
  996. <ul class="member-list">
  997. <h4>Type:</h4>
  998. <li>
  999. <a href="../classes/Point.html"><tt>Point</tt></a>
  1000. </li>
  1001. </ul>
  1002. </div>
  1003. </div>
  1004. </div>
  1005. <div id="bounds" class="member">
  1006. <div class="member-link">
  1007. <a name="bounds" href="#bounds"><tt><b>bounds</b></tt></a>
  1008. </div>
  1009. <div class="member-description hidden">
  1010. <div class="member-text">
  1011. <p>The bounding rectangle of the item excluding stroke width.</p>
  1012. <ul class="member-list">
  1013. <h4>Type:</h4>
  1014. <li>
  1015. <a href="../classes/Rectangle.html"><tt>Rectangle</tt></a>
  1016. </li>
  1017. </ul>
  1018. </div>
  1019. </div>
  1020. </div>
  1021. <div id="strokebounds" class="member">
  1022. <div class="member-link">
  1023. <a name="strokebounds" href="#strokebounds"><tt><b>strokeBounds</b></tt></a>
  1024. </div>
  1025. <div class="member-description hidden">
  1026. <div class="member-text">
  1027. <p>The bounding rectangle of the item including stroke width.</p>
  1028. <ul class="member-list">
  1029. <h4>Type:</h4>
  1030. <li>
  1031. <a href="../classes/Rectangle.html"><tt>Rectangle</tt></a>
  1032. </li>
  1033. </ul>
  1034. </div>
  1035. </div>
  1036. </div>
  1037. <div id="handlebounds" class="member">
  1038. <div class="member-link">
  1039. <a name="handlebounds" href="#handlebounds"><tt><b>handleBounds</b></tt></a>
  1040. </div>
  1041. <div class="member-description hidden">
  1042. <div class="member-text">
  1043. <p>The bounding rectangle of the item including handles.</p>
  1044. <ul class="member-list">
  1045. <h4>Type:</h4>
  1046. <li>
  1047. <a href="../classes/Rectangle.html"><tt>Rectangle</tt></a>
  1048. </li>
  1049. </ul>
  1050. </div>
  1051. </div>
  1052. </div>
  1053. <div id="internalbounds" class="member">
  1054. <div class="member-link">
  1055. <a name="internalbounds" href="#internalbounds"><tt><b>internalBounds</b></tt></a>
  1056. </div>
  1057. <div class="member-description hidden">
  1058. <div class="member-text">
  1059. <p>The bounding rectangle of the item without any matrix transformations.</p>
  1060. <p>Typical use case would be drawing a frame around the object where you want to draw something of the same size, position, rotation, and scaling, like a selection frame.</p>
  1061. <ul class="member-list">
  1062. <h4>Type:</h4>
  1063. <li>
  1064. <a href="../classes/Rectangle.html"><tt>Rectangle</tt></a>
  1065. </li>
  1066. </ul>
  1067. </div>
  1068. </div>
  1069. </div>
  1070. <div id="rotation" class="member">
  1071. <div class="member-link">
  1072. <a name="rotation" href="#rotation"><tt><b>rotation</b></tt></a>
  1073. </div>
  1074. <div class="member-description hidden">
  1075. <div class="member-text">
  1076. <p>The current rotation angle of the item, as described by its <a href="../classes/Item.html#matrix"><tt>matrix</tt></a>. Please note that this only returns meaningful values for items with <a href="../classes/Item.html#applymatrix"><tt>applyMatrix</tt></a> set to <code>false</code>, meaning they do not directly bake transformations into their content.</p>
  1077. <ul class="member-list">
  1078. <h4>Type:</h4>
  1079. <li>
  1080. <tt>Number</tt>
  1081. </li>
  1082. </ul>
  1083. </div>
  1084. </div>
  1085. </div>
  1086. <div id="scaling" class="member">
  1087. <div class="member-link">
  1088. <a name="scaling" href="#scaling"><tt><b>scaling</b></tt></a>
  1089. </div>
  1090. <div class="member-description hidden">
  1091. <div class="member-text">
  1092. <p>The current scale factor of the item, as described by its <a href="../classes/Item.html#matrix"><tt>matrix</tt></a>. Please note that this only returns meaningful values for items with <a href="../classes/Item.html#applymatrix"><tt>applyMatrix</tt></a> set to <code>false</code>, meaning they do not directly bake transformations into their content.</p>
  1093. <ul class="member-list">
  1094. <h4>Type:</h4>
  1095. <li>
  1096. <a href="../classes/Point.html"><tt>Point</tt></a>
  1097. </li>
  1098. </ul>
  1099. </div>
  1100. </div>
  1101. </div>
  1102. <div id="matrix" class="member">
  1103. <div class="member-link">
  1104. <a name="matrix" href="#matrix"><tt><b>matrix</b></tt></a>
  1105. </div>
  1106. <div class="member-description hidden">
  1107. <div class="member-text">
  1108. <p>The item&rsquo;s transformation matrix, defining position and dimensions in relation to its parent item in which it is contained.</p>
  1109. <ul class="member-list">
  1110. <h4>Type:</h4>
  1111. <li>
  1112. <a href="../classes/Matrix.html"><tt>Matrix</tt></a>
  1113. </li>
  1114. </ul>
  1115. </div>
  1116. </div>
  1117. </div>
  1118. <div id="globalmatrix" class="member">
  1119. <div class="member-link">
  1120. <a name="globalmatrix" href="#globalmatrix"><tt><b>globalMatrix</b></tt></a>
  1121. </div>
  1122. <div class="member-description hidden">
  1123. <div class="member-text">
  1124. <p>The item&rsquo;s global transformation matrix in relation to the global project coordinate space. Note that the view&rsquo;s transformations resulting from zooming and panning are not factored in.</p>
  1125. <p>Read only.</p>
  1126. <ul class="member-list">
  1127. <h4>Type:</h4>
  1128. <li>
  1129. <a href="../classes/Matrix.html"><tt>Matrix</tt></a>
  1130. </li>
  1131. </ul>
  1132. </div>
  1133. </div>
  1134. </div>
  1135. <div id="viewmatrix" class="member">
  1136. <div class="member-link">
  1137. <a name="viewmatrix" href="#viewmatrix"><tt><b>viewMatrix</b></tt></a>
  1138. </div>
  1139. <div class="member-description hidden">
  1140. <div class="member-text">
  1141. <p>The item&rsquo;s global matrix in relation to the view coordinate space. This means that the view&rsquo;s transformations resulting from zooming and panning are factored in.</p>
  1142. <p>Read only.</p>
  1143. <ul class="member-list">
  1144. <h4>Type:</h4>
  1145. <li>
  1146. <a href="../classes/Matrix.html"><tt>Matrix</tt></a>
  1147. </li>
  1148. </ul>
  1149. </div>
  1150. </div>
  1151. </div>
  1152. <div id="applymatrix" class="member">
  1153. <div class="member-link">
  1154. <a name="applymatrix" href="#applymatrix"><tt><b>applyMatrix</b></tt></a>
  1155. </div>
  1156. <div class="member-description hidden">
  1157. <div class="member-text">
  1158. <p>Controls whether the transformations applied to the item (e.g. through <a href="../classes/Item.html#transform-matrix"><tt>transform(matrix)</tt></a>, <a href="../classes/Item.html#rotate-angle"><tt>rotate(angle)</tt></a>, <a href="../classes/Item.html#scale-scale"><tt>scale(scale)</tt></a>, etc.) are stored in its <a href="../classes/Item.html#matrix"><tt>matrix</tt></a> property, or whether they are directly applied to its contents or children (passed on to the segments in <a href="../classes/Path.html"><tt>Path</tt></a> items, the children of <a href="../classes/Group.html"><tt>Group</tt></a> items, etc.).</p>
  1159. <ul class="member-list">
  1160. <h4>Default:</h4>
  1161. <li><tt>true</tt></li>
  1162. </ul>
  1163. <ul class="member-list">
  1164. <h4>Type:</h4>
  1165. <li>
  1166. <tt>Boolean</tt>
  1167. </li>
  1168. </ul>
  1169. </div>
  1170. </div>
  1171. </div>
  1172. <h3>Project Hierarchy</h3>
  1173. <div id="project" class="member">
  1174. <div class="member-link">
  1175. <a name="project" href="#project"><tt><b>project</b></tt></a>
  1176. </div>
  1177. <div class="member-description hidden">
  1178. <div class="member-text">
  1179. <p>The project that this item belongs to.</p>
  1180. <p>Read only.</p>
  1181. <ul class="member-list">
  1182. <h4>Type:</h4>
  1183. <li>
  1184. <a href="../classes/Project.html"><tt>Project</tt></a>
  1185. </li>
  1186. </ul>
  1187. </div>
  1188. </div>
  1189. </div>
  1190. <div id="view" class="member">
  1191. <div class="member-link">
  1192. <a name="view" href="#view"><tt><b>view</b></tt></a>
  1193. </div>
  1194. <div class="member-description hidden">
  1195. <div class="member-text">
  1196. <p>The view that this item belongs to.</p>
  1197. <p>Read only.</p>
  1198. <ul class="member-list">
  1199. <h4>Type:</h4>
  1200. <li>
  1201. <a href="../classes/View.html"><tt>View</tt></a>
  1202. </li>
  1203. </ul>
  1204. </div>
  1205. </div>
  1206. </div>
  1207. <div id="layer" class="member">
  1208. <div class="member-link">
  1209. <a name="layer" href="#layer"><tt><b>layer</b></tt></a>
  1210. </div>
  1211. <div class="member-description hidden">
  1212. <div class="member-text">
  1213. <p>The layer that this item is contained within.</p>
  1214. <p>Read only.</p>
  1215. <ul class="member-list">
  1216. <h4>Type:</h4>
  1217. <li>
  1218. <a href="../classes/Layer.html"><tt>Layer</tt></a>
  1219. </li>
  1220. </ul>
  1221. </div>
  1222. </div>
  1223. </div>
  1224. <div id="parent" class="member">
  1225. <div class="member-link">
  1226. <a name="parent" href="#parent"><tt><b>parent</b></tt></a>
  1227. </div>
  1228. <div class="member-description hidden">
  1229. <div class="member-text">
  1230. <p>The item that this item is contained within.</p>
  1231. <ul class="member-list">
  1232. <h4>Type:</h4>
  1233. <li>
  1234. <a href="../classes/Item.html"><tt>Item</tt></a>
  1235. </li>
  1236. </ul>
  1237. <h4>Example:</h4>
  1238. <pre><code>var path = new Path();
  1239. // New items are placed in the active layer:
  1240. console.log(path.parent == project.activeLayer); // true
  1241. var group = new Group();
  1242. group.addChild(path);
  1243. // Now the parent of the path has become the group:
  1244. console.log(path.parent == group); // true</code></pre>
  1245. <h4>Example:<span class="description">Setting the parent of the item to another item</span></h4>
  1246. <pre><code>var path = new Path();
  1247. // New items are placed in the active layer:
  1248. console.log(path.parent == project.activeLayer); // true
  1249. var group = new Group();
  1250. path.parent = group;
  1251. // Now the parent of the path has become the group:
  1252. console.log(path.parent == group); // true
  1253. // The path is now contained in the children list of group:
  1254. console.log(group.children[0] == path); // true</code></pre>
  1255. <h4>Example:<span class="description">Setting the parent of an item in the constructor</span></h4>
  1256. <pre><code>var group = new Group();
  1257. var path = new Path({
  1258. parent: group
  1259. });
  1260. // The parent of the path is the group:
  1261. console.log(path.parent == group); // true
  1262. // The path is contained in the children list of group:
  1263. console.log(group.children[0] == path); // true</code></pre>
  1264. </div>
  1265. </div>
  1266. </div>
  1267. <div id="children" class="member">
  1268. <div class="member-link">
  1269. <a name="children" href="#children"><tt><b>children</b></tt></a>
  1270. </div>
  1271. <div class="member-description hidden">
  1272. <div class="member-text">
  1273. <p>The children items contained within this item. Items that define a <a href="../classes/Item.html#name"><tt>name</tt></a> can also be accessed by name.</p>
  1274. <p><b>Please note:</b> The children array should not be modified directly using array functions. To remove single items from the children list, use <a href="../classes/Item.html#remove"><tt>item.remove</tt></a>(), to remove all items from the children list, use <a href="../classes/Item.html#removechildren"><tt>item.removeChildren</tt></a>(). To add items to the children list, use <a href="../classes/Item.html#addchild-item"><tt>item.addChild(item)</tt></a> or <a href="../classes/Item.html#insertchild-index-item"><tt>item.insertChild(index, item)</tt></a>.</p>
  1275. <ul class="member-list">
  1276. <h4>Type:</h4>
  1277. <li>
  1278. Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
  1279. </li>
  1280. </ul>
  1281. <h4>Example:<span class="description">Accessing items in the children array:</span></h4>
  1282. <div class="paperscript split">
  1283. <div class="buttons">
  1284. <div class="button run">Run</div>
  1285. </div>
  1286. <script type="text/paperscript" canvas="canvas-24">
  1287. var path = new Path.Circle({
  1288. center: [80, 50],
  1289. radius: 35
  1290. });
  1291. // Create a group and move the path into it:
  1292. var group = new Group();
  1293. group.addChild(path);
  1294. // Access the path through the group's children array:
  1295. group.children[0].fillColor = 'red';
  1296. </script>
  1297. <div class="canvas"><canvas width="516" height="100" id="canvas-24"></canvas></div>
  1298. </div>
  1299. <h4>Example:<span class="description">Accessing children by name:</span></h4>
  1300. <div class="paperscript split">
  1301. <div class="buttons">
  1302. <div class="button run">Run</div>
  1303. </div>
  1304. <script type="text/paperscript" canvas="canvas-25">
  1305. var path = new Path.Circle({
  1306. center: [80, 50],
  1307. radius: 35
  1308. });
  1309. // Set the name of the path:
  1310. path.name = 'example';
  1311. // Create a group and move the path into it:
  1312. var group = new Group();
  1313. group.addChild(path);
  1314. // The path can be accessed by name:
  1315. group.children['example'].fillColor = 'orange';
  1316. </script>
  1317. <div class="canvas"><canvas width="516" height="100" id="canvas-25"></canvas></div>
  1318. </div>
  1319. <h4>Example:<span class="description">Passing an array of items to item.children:</span></h4>
  1320. <div class="paperscript split">
  1321. <div class="buttons">
  1322. <div class="button run">Run</div>
  1323. </div>
  1324. <script type="text/paperscript" canvas="canvas-26">
  1325. var path = new Path.Circle({
  1326. center: [80, 50],
  1327. radius: 35
  1328. });
  1329. var group = new Group();
  1330. group.children = [path];
  1331. // The path is the first child of the group:
  1332. group.firstChild.fillColor = 'green';
  1333. </script>
  1334. <div class="canvas"><canvas width="516" height="100" id="canvas-26"></canvas></div>
  1335. </div>
  1336. </div>
  1337. </div>
  1338. </div>
  1339. <div id="firstchild" class="member">
  1340. <div class="member-link">
  1341. <a name="firstchild" href="#firstchild"><tt><b>firstChild</b></tt></a>
  1342. </div>
  1343. <div class="member-description hidden">
  1344. <div class="member-text">
  1345. <p>The first item contained within this item. This is a shortcut for accessing <code>item.children[0]</code>.</p>
  1346. <p>Read only.</p>
  1347. <ul class="member-list">
  1348. <h4>Type:</h4>
  1349. <li>
  1350. <a href="../classes/Item.html"><tt>Item</tt></a>
  1351. </li>
  1352. </ul>
  1353. </div>
  1354. </div>
  1355. </div>
  1356. <div id="lastchild" class="member">
  1357. <div class="member-link">
  1358. <a name="lastchild" href="#lastchild"><tt><b>lastChild</b></tt></a>
  1359. </div>
  1360. <div class="member-description hidden">
  1361. <div class="member-text">
  1362. <p>The last item contained within this item.This is a shortcut for accessing <code>item.children[item.children.length - 1]</code>.</p>
  1363. <p>Read only.</p>
  1364. <ul class="member-list">
  1365. <h4>Type:</h4>
  1366. <li>
  1367. <a href="../classes/Item.html"><tt>Item</tt></a>
  1368. </li>
  1369. </ul>
  1370. </div>
  1371. </div>
  1372. </div>
  1373. <div id="nextsibling" class="member">
  1374. <div class="member-link">
  1375. <a name="nextsibling" href="#nextsibling"><tt><b>nextSibling</b></tt></a>
  1376. </div>
  1377. <div class="member-description hidden">
  1378. <div class="member-text">
  1379. <p>The next item on the same level as this item.</p>
  1380. <p>Read only.</p>
  1381. <ul class="member-list">
  1382. <h4>Type:</h4>
  1383. <li>
  1384. <a href="../classes/Item.html"><tt>Item</tt></a>
  1385. </li>
  1386. </ul>
  1387. </div>
  1388. </div>
  1389. </div>
  1390. <div id="previoussibling" class="member">
  1391. <div class="member-link">
  1392. <a name="previoussibling" href="#previoussibling"><tt><b>previousSibling</b></tt></a>
  1393. </div>
  1394. <div class="member-description hidden">
  1395. <div class="member-text">
  1396. <p>The previous item on the same level as this item.</p>
  1397. <p>Read only.</p>
  1398. <ul class="member-list">
  1399. <h4>Type:</h4>
  1400. <li>
  1401. <a href="../classes/Item.html"><tt>Item</tt></a>
  1402. </li>
  1403. </ul>
  1404. </div>
  1405. </div>
  1406. </div>
  1407. <div id="index" class="member">
  1408. <div class="member-link">
  1409. <a name="index" href="#index"><tt><b>index</b></tt></a>
  1410. </div>
  1411. <div class="member-description hidden">
  1412. <div class="member-text">
  1413. <p>The index of this item within the list of its parent&rsquo;s children.</p>
  1414. <p>Read only.</p>
  1415. <ul class="member-list">
  1416. <h4>Type:</h4>
  1417. <li>
  1418. <tt>Number</tt>
  1419. </li>
  1420. </ul>
  1421. </div>
  1422. </div>
  1423. </div>
  1424. <h3>Stroke Style</h3>
  1425. <div id="strokecolor" class="member">
  1426. <div class="member-link">
  1427. <a name="strokecolor" href="#strokecolor"><tt><b>strokeColor</b></tt></a>
  1428. </div>
  1429. <div class="member-description hidden">
  1430. <div class="member-text">
  1431. <p>The color of the stroke.</p>
  1432. <ul class="member-list">
  1433. <h4>Type:</h4>
  1434. <li>
  1435. <a href="../classes/Color.html"><tt>Color</tt></a>⟋<tt>null</tt>
  1436. </li>
  1437. </ul>
  1438. <h4>Example:<span class="description">Setting the stroke color of a path:</span></h4>
  1439. <div class="paperscript split">
  1440. <div class="buttons">
  1441. <div class="button run">Run</div>
  1442. </div>
  1443. <script type="text/paperscript" canvas="canvas-27">
  1444. // Create a circle shaped path at { x: 80, y: 50 }
  1445. // with a radius of 35:
  1446. var circle = new Path.Circle({
  1447. center: [80, 50],
  1448. radius: 35
  1449. });
  1450. // Set its stroke color to RGB red:
  1451. circle.strokeColor = new Color(1, 0, 0);
  1452. </script>
  1453. <div class="canvas"><canvas width="516" height="100" id="canvas-27"></canvas></div>
  1454. </div>
  1455. </div>
  1456. </div>
  1457. </div>
  1458. <div id="strokewidth" class="member">
  1459. <div class="member-link">
  1460. <a name="strokewidth" href="#strokewidth"><tt><b>strokeWidth</b></tt></a>
  1461. </div>
  1462. <div class="member-description hidden">
  1463. <div class="member-text">
  1464. <p>The width of the stroke.</p>
  1465. <ul class="member-list">
  1466. <h4>Type:</h4>
  1467. <li>
  1468. <tt>Number</tt>
  1469. </li>
  1470. </ul>
  1471. <h4>Example:<span class="description">Setting an item's stroke width:</span></h4>
  1472. <div class="paperscript split">
  1473. <div class="buttons">
  1474. <div class="button run">Run</div>
  1475. </div>
  1476. <script type="text/paperscript" canvas="canvas-28">
  1477. // Create a circle shaped path at { x: 80, y: 50 }
  1478. // with a radius of 35:
  1479. var circle = new Path.Circle({
  1480. center: [80, 50],
  1481. radius: 35,
  1482. strokeColor: 'red'
  1483. });
  1484. // Set its stroke width to 10:
  1485. circle.strokeWidth = 10;
  1486. </script>
  1487. <div class="canvas"><canvas width="516" height="100" id="canvas-28"></canvas></div>
  1488. </div>
  1489. </div>
  1490. </div>
  1491. </div>
  1492. <div id="strokecap" class="member">
  1493. <div class="member-link">
  1494. <a name="strokecap" href="#strokecap"><tt><b>strokeCap</b></tt></a>
  1495. </div>
  1496. <div class="member-description hidden">
  1497. <div class="member-text">
  1498. <p>The shape to be used at the beginning and end of open <a href="../classes/Path.html"><tt>Path</tt></a> items, when they have a stroke.</p>
  1499. <ul class="member-list">
  1500. <h4>Values:</h4>
  1501. <li><tt>'round'</tt>, <tt>'square'</tt>, <tt>'butt'</tt></li>
  1502. </ul>
  1503. <ul class="member-list">
  1504. <h4>Default:</h4>
  1505. <li><tt>'butt'</tt></li>
  1506. </ul>
  1507. <ul class="member-list">
  1508. <h4>Type:</h4>
  1509. <li>
  1510. <tt>String</tt>
  1511. </li>
  1512. </ul>
  1513. <h4>Example:<span class="description">A look at the different stroke caps:</span></h4>
  1514. <div class="paperscript split">
  1515. <div class="buttons">
  1516. <div class="button run">Run</div>
  1517. </div>
  1518. <script type="text/paperscript" canvas="canvas-29">
  1519. var line = new Path({
  1520. segments: [[80, 50], [420, 50]],
  1521. strokeColor: 'black',
  1522. strokeWidth: 20,
  1523. selected: true
  1524. });
  1525. // Set the stroke cap of the line to be round:
  1526. line.strokeCap = 'round';
  1527. // Copy the path and set its stroke cap to be square:
  1528. var line2 = line.clone();
  1529. line2.position.y += 50;
  1530. line2.strokeCap = 'square';
  1531. // Make another copy and set its stroke cap to be butt:
  1532. var line2 = line.clone();
  1533. line2.position.y += 100;
  1534. line2.strokeCap = 'butt';
  1535. </script>
  1536. <div class="canvas"><canvas width="516" height="200" id="canvas-29"></canvas></div>
  1537. </div>
  1538. </div>
  1539. </div>
  1540. </div>
  1541. <div id="strokejoin" class="member">
  1542. <div class="member-link">
  1543. <a name="strokejoin" href="#strokejoin"><tt><b>strokeJoin</b></tt></a>
  1544. </div>
  1545. <div class="member-description hidden">
  1546. <div class="member-text">
  1547. <p>The shape to be used at the segments and corners of <a href="../classes/Path.html"><tt>Path</tt></a> items when they have a stroke.</p>
  1548. <ul class="member-list">
  1549. <h4>Values:</h4>
  1550. <li><tt>'miter'</tt>, <tt>'round'</tt>, <tt>'bevel'</tt></li>
  1551. </ul>
  1552. <ul class="member-list">
  1553. <h4>Default:</h4>
  1554. <li><tt>'miter'</tt></li>
  1555. </ul>
  1556. <ul class="member-list">
  1557. <h4>Type:</h4>
  1558. <li>
  1559. <tt>String</tt>
  1560. </li>
  1561. </ul>
  1562. <h4>Example:<span class="description">A look at the different stroke joins:</span></h4>
  1563. <div class="paperscript split">
  1564. <div class="buttons">
  1565. <div class="button run">Run</div>
  1566. </div>
  1567. <script type="text/paperscript" canvas="canvas-30">
  1568. var path = new Path({
  1569. segments: [[80, 100], [120, 40], [160, 100]],
  1570. strokeColor: 'black',
  1571. strokeWidth: 20,
  1572. // Select the path, in order to see where the stroke is formed:
  1573. selected: true
  1574. });
  1575. var path2 = path.clone();
  1576. path2.position.x += path2.bounds.width * 1.5;
  1577. path2.strokeJoin = 'round';
  1578. var path3 = path2.clone();
  1579. path3.position.x += path3.bounds.width * 1.5;
  1580. path3.strokeJoin = 'bevel';
  1581. </script>
  1582. <div class="canvas"><canvas width="516" height="120" id="canvas-30"></canvas></div>
  1583. </div>
  1584. </div>
  1585. </div>
  1586. </div>
  1587. <div id="dashoffset" class="member">
  1588. <div class="member-link">
  1589. <a name="dashoffset" href="#dashoffset"><tt><b>dashOffset</b></tt></a>
  1590. </div>
  1591. <div class="member-description hidden">
  1592. <div class="member-text">
  1593. <p>The dash offset of the stroke.</p>
  1594. <ul class="member-list">
  1595. <h4>Default:</h4>
  1596. <li><tt>0</tt></li>
  1597. </ul>
  1598. <ul class="member-list">
  1599. <h4>Type:</h4>
  1600. <li>
  1601. <tt>Number</tt>
  1602. </li>
  1603. </ul>
  1604. </div>
  1605. </div>
  1606. </div>
  1607. <div id="strokescaling" class="member">
  1608. <div class="member-link">
  1609. <a name="strokescaling" href="#strokescaling"><tt><b>strokeScaling</b></tt></a>
  1610. </div>
  1611. <div class="member-description hidden">
  1612. <div class="member-text">
  1613. <p>Specifies whether the stroke is to be drawn taking the current affine transformation into account (the default behavior), or whether it should appear as a non-scaling stroke.</p>
  1614. <ul class="member-list">
  1615. <h4>Default:</h4>
  1616. <li><tt>true</tt></li>
  1617. </ul>
  1618. <ul class="member-list">
  1619. <h4>Type:</h4>
  1620. <li>
  1621. <tt>Boolean</tt>
  1622. </li>
  1623. </ul>
  1624. </div>
  1625. </div>
  1626. </div>
  1627. <div id="dasharray" class="member">
  1628. <div class="member-link">
  1629. <a name="dasharray" href="#dasharray"><tt><b>dashArray</b></tt></a>
  1630. </div>
  1631. <div class="member-description hidden">
  1632. <div class="member-text">
  1633. <p>Specifies an array containing the dash and gap lengths of the stroke.</p>
  1634. <ul class="member-list">
  1635. <h4>Default:</h4>
  1636. <li><tt>[]</tt></li>
  1637. </ul>
  1638. <ul class="member-list">
  1639. <h4>Type:</h4>
  1640. <li>
  1641. Array of <tt>Numbers</tt>
  1642. </li>
  1643. </ul>
  1644. <h4>Example:</h4>
  1645. <div class="paperscript split">
  1646. <div class="buttons">
  1647. <div class="button run">Run</div>
  1648. </div>
  1649. <script type="text/paperscript" canvas="canvas-31">
  1650. var path = new Path.Circle({
  1651. center: [80, 50],
  1652. radius: 40,
  1653. strokeWidth: 2,
  1654. strokeColor: 'black'
  1655. });
  1656. // Set the dashed stroke to [10pt dash, 4pt gap]:
  1657. path.dashArray = [10, 4];
  1658. </script>
  1659. <div class="canvas"><canvas width="516" height="100" id="canvas-31"></canvas></div>
  1660. </div>
  1661. </div>
  1662. </div>
  1663. </div>
  1664. <div id="miterlimit" class="member">
  1665. <div class="member-link">
  1666. <a name="miterlimit" href="#miterlimit"><tt><b>miterLimit</b></tt></a>
  1667. </div>
  1668. <div class="member-description hidden">
  1669. <div class="member-text">
  1670. <p>The miter limit of the stroke. When two line segments meet at a sharp angle and miter joins have been specified for <a href="../classes/Item.html#strokejoin"><tt>item.strokeJoin</tt></a>, it is possible for the miter to extend far beyond the <a href="../classes/Item.html#strokewidth"><tt>item.strokeWidth</tt></a> of the path. The miterLimit imposes a limit on the ratio of the miter length to the <a href="../classes/Item.html#strokewidth"><tt>item.strokeWidth</tt></a>.</p>
  1671. <ul class="member-list">
  1672. <h4>Default:</h4>
  1673. <li><tt>10</tt></li>
  1674. </ul>
  1675. <ul class="member-list">
  1676. <h4>Type:</h4>
  1677. <li>
  1678. <tt>Number</tt>
  1679. </li>
  1680. </ul>
  1681. </div>
  1682. </div>
  1683. </div>
  1684. <h3>Fill Style</h3>
  1685. <div id="fillcolor" class="member">
  1686. <div class="member-link">
  1687. <a name="fillcolor" href="#fillcolor"><tt><b>fillColor</b></tt></a>
  1688. </div>
  1689. <div class="member-description hidden">
  1690. <div class="member-text">
  1691. <p>The fill color of the item.</p>
  1692. <ul class="member-list">
  1693. <h4>Type:</h4>
  1694. <li>
  1695. <a href="../classes/Color.html"><tt>Color</tt></a>⟋<tt>null</tt>
  1696. </li>
  1697. </ul>
  1698. <h4>Example:<span class="description">Setting the fill color of a path to red:</span></h4>
  1699. <div class="paperscript split">
  1700. <div class="buttons">
  1701. <div class="button run">Run</div>
  1702. </div>
  1703. <script type="text/paperscript" canvas="canvas-32">
  1704. // Create a circle shaped path at { x: 80, y: 50 }
  1705. // with a radius of 35:
  1706. var circle = new Path.Circle({
  1707. center: [80, 50],
  1708. radius: 35
  1709. });
  1710. // Set the fill color of the circle to RGB red:
  1711. circle.fillColor = new Color(1, 0, 0);
  1712. </script>
  1713. <div class="canvas"><canvas width="516" height="100" id="canvas-32"></canvas></div>
  1714. </div>
  1715. </div>
  1716. </div>
  1717. </div>
  1718. <div id="fillrule" class="member">
  1719. <div class="member-link">
  1720. <a name="fillrule" href="#fillrule"><tt><b>fillRule</b></tt></a>
  1721. </div>
  1722. <div class="member-description hidden">
  1723. <div class="member-text">
  1724. <p>The fill-rule with which the shape gets filled. Please note that only modern browsers support fill-rules other than <code>&#39;nonzero&#39;</code>.</p>
  1725. <ul class="member-list">
  1726. <h4>Values:</h4>
  1727. <li><tt>'nonzero'</tt>, <tt>'evenodd'</tt></li>
  1728. </ul>
  1729. <ul class="member-list">
  1730. <h4>Default:</h4>
  1731. <li><tt>'nonzero'</tt></li>
  1732. </ul>
  1733. <ul class="member-list">
  1734. <h4>Type:</h4>
  1735. <li>
  1736. <tt>String</tt>
  1737. </li>
  1738. </ul>
  1739. </div>
  1740. </div>
  1741. </div>
  1742. <h3>Shadow Style</h3>
  1743. <div id="shadowcolor" class="member">
  1744. <div class="member-link">
  1745. <a name="shadowcolor" href="#shadowcolor"><tt><b>shadowColor</b></tt></a>
  1746. </div>
  1747. <div class="member-description hidden">
  1748. <div class="member-text">
  1749. <p>The shadow color.</p>
  1750. <ul class="member-list">
  1751. <h4>Type:</h4>
  1752. <li>
  1753. <a href="../classes/Color.html"><tt>Color</tt></a>⟋<tt>null</tt>
  1754. </li>
  1755. </ul>
  1756. <h4>Example:<span class="description">Creating a circle with a black shadow:</span></h4>
  1757. <div class="paperscript split">
  1758. <div class="buttons">
  1759. <div class="button run">Run</div>
  1760. </div>
  1761. <script type="text/paperscript" canvas="canvas-33">
  1762. var circle = new Path.Circle({
  1763. center: [80, 50],
  1764. radius: 35,
  1765. fillColor: 'white',
  1766. // Set the shadow color of the circle to RGB black:
  1767. shadowColor: new Color(0, 0, 0),
  1768. // Set the shadow blur radius to 12:
  1769. shadowBlur: 12,
  1770. // Offset the shadow by { x: 5, y: 5 }
  1771. shadowOffset: new Point(5, 5)
  1772. });
  1773. </script>
  1774. <div class="canvas"><canvas width="516" height="100" id="canvas-33"></canvas></div>
  1775. </div>
  1776. </div>
  1777. </div>
  1778. </div>
  1779. <div id="shadowblur" class="member">
  1780. <div class="member-link">
  1781. <a name="shadowblur" href="#shadowblur"><tt><b>shadowBlur</b></tt></a>
  1782. </div>
  1783. <div class="member-description hidden">
  1784. <div class="member-text">
  1785. <p>The shadow&rsquo;s blur radius.</p>
  1786. <ul class="member-list">
  1787. <h4>Default:</h4>
  1788. <li><tt>0</tt></li>
  1789. </ul>
  1790. <ul class="member-list">
  1791. <h4>Type:</h4>
  1792. <li>
  1793. <tt>Number</tt>
  1794. </li>
  1795. </ul>
  1796. </div>
  1797. </div>
  1798. </div>
  1799. <div id="shadowoffset" class="member">
  1800. <div class="member-link">
  1801. <a name="shadowoffset" href="#shadowoffset"><tt><b>shadowOffset</b></tt></a>
  1802. </div>
  1803. <div class="member-description hidden">
  1804. <div class="member-text">
  1805. <p>The shadow&rsquo;s offset.</p>
  1806. <ul class="member-list">
  1807. <h4>Default:</h4>
  1808. <li><tt>0</tt></li>
  1809. </ul>
  1810. <ul class="member-list">
  1811. <h4>Type:</h4>
  1812. <li>
  1813. <a href="../classes/Point.html"><tt>Point</tt></a>
  1814. </li>
  1815. </ul>
  1816. </div>
  1817. </div>
  1818. </div>
  1819. <h3>Selection Style</h3>
  1820. <div id="selectedcolor" class="member">
  1821. <div class="member-link">
  1822. <a name="selectedcolor" href="#selectedcolor"><tt><b>selectedColor</b></tt></a>
  1823. </div>
  1824. <div class="member-description hidden">
  1825. <div class="member-text">
  1826. <p>The color the item is highlighted with when selected. If the item does not specify its own color, the color defined by its layer is used instead.</p>
  1827. <ul class="member-list">
  1828. <h4>Type:</h4>
  1829. <li>
  1830. <a href="../classes/Color.html"><tt>Color</tt></a>⟋<tt>null</tt>
  1831. </li>
  1832. </ul>
  1833. </div>
  1834. </div>
  1835. </div>
  1836. <h3>Event Handlers</h3>
  1837. <div id="onframe" class="member">
  1838. <div class="member-link">
  1839. <a name="onframe" href="#onframe"><tt><b>onFrame</b></tt></a>
  1840. </div>
  1841. <div class="member-description hidden">
  1842. <div class="member-text">
  1843. <p>Item level handler function to be called on each frame of an animation. The function receives an event object which contains information about the frame event:</p>
  1844. <ul class="member-list">
  1845. <h4>Type:</h4>
  1846. <li>
  1847. <tt>Function</tt>⟋<tt>null</tt>
  1848. </li>
  1849. </ul>
  1850. <ul class="member-list">
  1851. <h4>Options:</h4>
  1852. <li><tt>event.count: <tt>Number</tt></tt> &mdash; the number of times the frame event was fired</li>
  1853. <li><tt>event.time: <tt>Number</tt></tt> &mdash; the total amount of time passed since the first frame event in seconds</li>
  1854. <li><tt>event.delta: <tt>Number</tt></tt> &mdash; the time passed in seconds since the last frame event</li>
  1855. </ul>
  1856. <ul class="member-list">
  1857. <h4>See also:</h4>
  1858. <li><tt><a href="../classes/View.html#onframe"><tt>view.onFrame</tt></a></tt></li>
  1859. </ul>
  1860. <h4>Example:<span class="description">Creating an animation:</span></h4>
  1861. <div class="paperscript split">
  1862. <div class="buttons">
  1863. <div class="button run">Run</div>
  1864. </div>
  1865. <script type="text/paperscript" canvas="canvas-34">
  1866. // Create a rectangle shaped path with its top left point at:
  1867. // {x: 50, y: 25} and a size of {width: 50, height: 50}
  1868. var path = new Path.Rectangle(new Point(50, 25), new Size(50, 50));
  1869. path.fillColor = 'black';
  1870. path.onFrame = function(event) {
  1871. // Every frame, rotate the path by 3 degrees:
  1872. this.rotate(3);
  1873. }
  1874. </script>
  1875. <div class="canvas"><canvas width="516" height="100" id="canvas-34"></canvas></div>
  1876. </div>
  1877. </div>
  1878. </div>
  1879. </div>
  1880. <div id="onmousedown" class="member">
  1881. <div class="member-link">
  1882. <a name="onmousedown" href="#onmousedown"><tt><b>onMouseDown</b></tt></a>
  1883. </div>
  1884. <div class="member-description hidden">
  1885. <div class="member-text">
  1886. <p>The function to be called when the mouse button is pushed down on the item. The function receives a <a href="../classes/MouseEvent.html"><tt>MouseEvent</tt></a> object which contains information about the mouse event. Note that such mouse events bubble up the scene graph hierarchy and will reach the view, unless they are stopped with <a href="../classes/Event.html#stoppropagation"><tt>event.stopPropagation</tt></a>() or by returning <code>false</code> from the handler.</p>
  1887. <ul class="member-list">
  1888. <h4>Type:</h4>
  1889. <li>
  1890. <tt>Function</tt>⟋<tt>null</tt>
  1891. </li>
  1892. </ul>
  1893. <ul class="member-list">
  1894. <h4>See also:</h4>
  1895. <li><tt><a href="../classes/View.html#onmousedown"><tt>view.onMouseDown</tt></a></tt></li>
  1896. </ul>
  1897. <h4>Example:<span class="description">Press the mouse button down on the circle shaped path, to make it red:</span></h4>
  1898. <div class="paperscript split">
  1899. <div class="buttons">
  1900. <div class="button run">Run</div>
  1901. </div>
  1902. <script type="text/paperscript" canvas="canvas-35">
  1903. // Create a circle shaped path at the center of the view:
  1904. var path = new Path.Circle({
  1905. center: view.center,
  1906. radius: 25,
  1907. fillColor: 'black'
  1908. });
  1909. // When the mouse is pressed on the item,
  1910. // set its fill color to red:
  1911. path.onMouseDown = function(event) {
  1912. this.fillColor = 'red';
  1913. }
  1914. </script>
  1915. <div class="canvas"><canvas width="516" height="100" id="canvas-35"></canvas></div>
  1916. </div>
  1917. <h4>Example:<span class="description">Press the mouse on the circle shaped paths to remove them:</span></h4>
  1918. <div class="paperscript split">
  1919. <div class="buttons">
  1920. <div class="button run">Run</div>
  1921. </div>
  1922. <script type="text/paperscript" canvas="canvas-36">
  1923. // Loop 30 times:
  1924. for (var i = 0; i < 30; i++) {
  1925. // Create a circle shaped path at a random position
  1926. // in the view:
  1927. var path = new Path.Circle({
  1928. center: Point.random() * view.size,
  1929. radius: 25,
  1930. fillColor: 'black',
  1931. strokeColor: 'white'
  1932. });
  1933. // When the mouse is pressed on the item, remove it:
  1934. path.onMouseDown = function(event) {
  1935. this.remove();
  1936. }
  1937. }
  1938. </script>
  1939. <div class="canvas"><canvas width="516" height="100" id="canvas-36"></canvas></div>
  1940. </div>
  1941. </div>
  1942. </div>
  1943. </div>
  1944. <div id="onmousedrag" class="member">
  1945. <div class="member-link">
  1946. <a name="onmousedrag" href="#onmousedrag"><tt><b>onMouseDrag</b></tt></a>
  1947. </div>
  1948. <div class="member-description hidden">
  1949. <div class="member-text">
  1950. <p>The function to be called when the mouse position changes while the mouse is being dragged over the item. The function receives a <a href="../classes/MouseEvent.html"><tt>MouseEvent</tt></a> object which contains information about the mouse event. Note that such mouse events bubble up the scene graph hierarchy and will reach the view, unless they are stopped with <a href="../classes/Event.html#stoppropagation"><tt>event.stopPropagation</tt></a>() or by returning <code>false</code> from the handler.</p>
  1951. <ul class="member-list">
  1952. <h4>Type:</h4>
  1953. <li>
  1954. <tt>Function</tt>⟋<tt>null</tt>
  1955. </li>
  1956. </ul>
  1957. <ul class="member-list">
  1958. <h4>See also:</h4>
  1959. <li><tt><a href="../classes/View.html#onmousedrag"><tt>view.onMouseDrag</tt></a></tt></li>
  1960. </ul>
  1961. <h4>Example:<span class="description">Press and drag the mouse on the blue circle to move it:</span></h4>
  1962. <div class="paperscript split">
  1963. <div class="buttons">
  1964. <div class="button run">Run</div>
  1965. </div>
  1966. <script type="text/paperscript" canvas="canvas-37">
  1967. // Create a circle shaped path at the center of the view:
  1968. var path = new Path.Circle({
  1969. center: view.center,
  1970. radius: 50,
  1971. fillColor: 'blue'
  1972. });
  1973. // Install a drag event handler that moves the path along.
  1974. path.onMouseDrag = function(event) {
  1975. path.position += event.delta;
  1976. }
  1977. </script>
  1978. <div class="canvas"><canvas width="516" height="240" id="canvas-37"></canvas></div>
  1979. </div>
  1980. </div>
  1981. </div>
  1982. </div>
  1983. <div id="onmouseup" class="member">
  1984. <div class="member-link">
  1985. <a name="onmouseup" href="#onmouseup"><tt><b>onMouseUp</b></tt></a>
  1986. </div>
  1987. <div class="member-description hidden">
  1988. <div class="member-text">
  1989. <p>The function to be called when the mouse button is released over the item. The function receives a <a href="../classes/MouseEvent.html"><tt>MouseEvent</tt></a> object which contains information about the mouse event. Note that such mouse events bubble up the scene graph hierarchy and will reach the view, unless they are stopped with <a href="../classes/Event.html#stoppropagation"><tt>event.stopPropagation</tt></a>() or by returning <code>false</code> from the handler.</p>
  1990. <ul class="member-list">
  1991. <h4>Type:</h4>
  1992. <li>
  1993. <tt>Function</tt>⟋<tt>null</tt>
  1994. </li>
  1995. </ul>
  1996. <ul class="member-list">
  1997. <h4>See also:</h4>
  1998. <li><tt><a href="../classes/View.html#onmouseup"><tt>view.onMouseUp</tt></a></tt></li>
  1999. </ul>
  2000. <h4>Example:<span class="description">Release the mouse button over the circle shaped path, to make it red:</span></h4>
  2001. <div class="paperscript split">
  2002. <div class="buttons">
  2003. <div class="button run">Run</div>
  2004. </div>
  2005. <script type="text/paperscript" canvas="canvas-38">
  2006. // Create a circle shaped path at the center of the view:
  2007. var path = new Path.Circle({
  2008. center: view.center,
  2009. radius: 25,
  2010. fillColor: 'black'
  2011. });
  2012. // When the mouse is released over the item,
  2013. // set its fill color to red:
  2014. path.onMouseUp = function(event) {
  2015. this.fillColor = 'red';
  2016. }
  2017. </script>
  2018. <div class="canvas"><canvas width="516" height="100" id="canvas-38"></canvas></div>
  2019. </div>
  2020. </div>
  2021. </div>
  2022. </div>
  2023. <div id="onclick" class="member">
  2024. <div class="member-link">
  2025. <a name="onclick" href="#onclick"><tt><b>onClick</b></tt></a>
  2026. </div>
  2027. <div class="member-description hidden">
  2028. <div class="member-text">
  2029. <p>The function to be called when the mouse clicks on the item. The function receives a <a href="../classes/MouseEvent.html"><tt>MouseEvent</tt></a> object which contains information about the mouse event. Note that such mouse events bubble up the scene graph hierarchy and will reach the view, unless they are stopped with <a href="../classes/Event.html#stoppropagation"><tt>event.stopPropagation</tt></a>() or by returning <code>false</code> from the handler.</p>
  2030. <ul class="member-list">
  2031. <h4>Type:</h4>
  2032. <li>
  2033. <tt>Function</tt>⟋<tt>null</tt>
  2034. </li>
  2035. </ul>
  2036. <ul class="member-list">
  2037. <h4>See also:</h4>
  2038. <li><tt><a href="../classes/View.html#onclick"><tt>view.onClick</tt></a></tt></li>
  2039. </ul>
  2040. <h4>Example:<span class="description">Click on the circle shaped path, to make it red:</span></h4>
  2041. <div class="paperscript split">
  2042. <div class="buttons">
  2043. <div class="button run">Run</div>
  2044. </div>
  2045. <script type="text/paperscript" canvas="canvas-39">
  2046. // Create a circle shaped path at the center of the view:
  2047. var path = new Path.Circle({
  2048. center: view.center,
  2049. radius: 25,
  2050. fillColor: 'black'
  2051. });
  2052. // When the mouse is clicked on the item,
  2053. // set its fill color to red:
  2054. path.onClick = function(event) {
  2055. this.fillColor = 'red';
  2056. }
  2057. </script>
  2058. <div class="canvas"><canvas width="516" height="100" id="canvas-39"></canvas></div>
  2059. </div>
  2060. <h4>Example:<span class="description">Click on the circle shaped paths to remove them:</span></h4>
  2061. <div class="paperscript split">
  2062. <div class="buttons">
  2063. <div class="button run">Run</div>
  2064. </div>
  2065. <script type="text/paperscript" canvas="canvas-40">
  2066. // Loop 30 times:
  2067. for (var i = 0; i < 30; i++) {
  2068. // Create a circle shaped path at a random position
  2069. // in the view:
  2070. var path = new Path.Circle({
  2071. center: Point.random() * view.size,
  2072. radius: 25,
  2073. fillColor: 'black',
  2074. strokeColor: 'white'
  2075. });
  2076. // When the mouse clicks on the item, remove it:
  2077. path.onClick = function(event) {
  2078. this.remove();
  2079. }
  2080. }
  2081. </script>
  2082. <div class="canvas"><canvas width="516" height="100" id="canvas-40"></canvas></div>
  2083. </div>
  2084. </div>
  2085. </div>
  2086. </div>
  2087. <div id="ondoubleclick" class="member">
  2088. <div class="member-link">
  2089. <a name="ondoubleclick" href="#ondoubleclick"><tt><b>onDoubleClick</b></tt></a>
  2090. </div>
  2091. <div class="member-description hidden">
  2092. <div class="member-text">
  2093. <p>The function to be called when the mouse double clicks on the item. The function receives a <a href="../classes/MouseEvent.html"><tt>MouseEvent</tt></a> object which contains information about the mouse event. Note that such mouse events bubble up the scene graph hierarchy and will reach the view, unless they are stopped with <a href="../classes/Event.html#stoppropagation"><tt>event.stopPropagation</tt></a>() or by returning <code>false</code> from the handler.</p>
  2094. <ul class="member-list">
  2095. <h4>Type:</h4>
  2096. <li>
  2097. <tt>Function</tt>⟋<tt>null</tt>
  2098. </li>
  2099. </ul>
  2100. <ul class="member-list">
  2101. <h4>See also:</h4>
  2102. <li><tt><a href="../classes/View.html#ondoubleclick"><tt>view.onDoubleClick</tt></a></tt></li>
  2103. </ul>
  2104. <h4>Example:<span class="description">Double click on the circle shaped path, to make it red:</span></h4>
  2105. <div class="paperscript split">
  2106. <div class="buttons">
  2107. <div class="button run">Run</div>
  2108. </div>
  2109. <script type="text/paperscript" canvas="canvas-41">
  2110. // Create a circle shaped path at the center of the view:
  2111. var path = new Path.Circle({
  2112. center: view.center,
  2113. radius: 25,
  2114. fillColor: 'black'
  2115. });
  2116. // When the mouse is double clicked on the item,
  2117. // set its fill color to red:
  2118. path.onDoubleClick = function(event) {
  2119. this.fillColor = 'red';
  2120. }
  2121. </script>
  2122. <div class="canvas"><canvas width="516" height="100" id="canvas-41"></canvas></div>
  2123. </div>
  2124. <h4>Example:<span class="description">Double click on the circle shaped paths to remove them:</span></h4>
  2125. <div class="paperscript split">
  2126. <div class="buttons">
  2127. <div class="button run">Run</div>
  2128. </div>
  2129. <script type="text/paperscript" canvas="canvas-42">
  2130. // Loop 30 times:
  2131. for (var i = 0; i < 30; i++) {
  2132. // Create a circle shaped path at a random position
  2133. // in the view:
  2134. var path = new Path.Circle({
  2135. center: Point.random() * view.size,
  2136. radius: 25,
  2137. fillColor: 'black',
  2138. strokeColor: 'white'
  2139. });
  2140. // When the mouse is double clicked on the item, remove it:
  2141. path.onDoubleClick = function(event) {
  2142. this.remove();
  2143. }
  2144. }
  2145. </script>
  2146. <div class="canvas"><canvas width="516" height="100" id="canvas-42"></canvas></div>
  2147. </div>
  2148. </div>
  2149. </div>
  2150. </div>
  2151. <div id="onmousemove" class="member">
  2152. <div class="member-link">
  2153. <a name="onmousemove" href="#onmousemove"><tt><b>onMouseMove</b></tt></a>
  2154. </div>
  2155. <div class="member-description hidden">
  2156. <div class="member-text">
  2157. <p>The function to be called repeatedly while the mouse moves over the item. The function receives a <a href="../classes/MouseEvent.html"><tt>MouseEvent</tt></a> object which contains information about the mouse event. Note that such mouse events bubble up the scene graph hierarchy and will reach the view, unless they are stopped with <a href="../classes/Event.html#stoppropagation"><tt>event.stopPropagation</tt></a>() or by returning <code>false</code> from the handler.</p>
  2158. <ul class="member-list">
  2159. <h4>Type:</h4>
  2160. <li>
  2161. <tt>Function</tt>⟋<tt>null</tt>
  2162. </li>
  2163. </ul>
  2164. <ul class="member-list">
  2165. <h4>See also:</h4>
  2166. <li><tt><a href="../classes/View.html#onmousemove"><tt>view.onMouseMove</tt></a></tt></li>
  2167. </ul>
  2168. <h4>Example:<span class="description">Move over the circle shaped path, to change its opacity:</span></h4>
  2169. <div class="paperscript split">
  2170. <div class="buttons">
  2171. <div class="button run">Run</div>
  2172. </div>
  2173. <script type="text/paperscript" canvas="canvas-43">
  2174. // Create a circle shaped path at the center of the view:
  2175. var path = new Path.Circle({
  2176. center: view.center,
  2177. radius: 25,
  2178. fillColor: 'black'
  2179. });
  2180. // When the mouse moves on top of the item, set its opacity
  2181. // to a random value between 0 and 1:
  2182. path.onMouseMove = function(event) {
  2183. this.opacity = Math.random();
  2184. }
  2185. </script>
  2186. <div class="canvas"><canvas width="516" height="100" id="canvas-43"></canvas></div>
  2187. </div>
  2188. </div>
  2189. </div>
  2190. </div>
  2191. <div id="onmouseenter" class="member">
  2192. <div class="member-link">
  2193. <a name="onmouseenter" href="#onmouseenter"><tt><b>onMouseEnter</b></tt></a>
  2194. </div>
  2195. <div class="member-description hidden">
  2196. <div class="member-text">
  2197. <p>The function to be called when the mouse moves over the item. This function will only be called again, once the mouse moved outside of the item first. The function receives a <a href="../classes/MouseEvent.html"><tt>MouseEvent</tt></a> object which contains information about the mouse event. Note that such mouse events bubble up the scene graph hierarchy and will reach the view, unless they are stopped with <a href="../classes/Event.html#stoppropagation"><tt>event.stopPropagation</tt></a>() or by returning <code>false</code> from the handler.</p>
  2198. <ul class="member-list">
  2199. <h4>Type:</h4>
  2200. <li>
  2201. <tt>Function</tt>⟋<tt>null</tt>
  2202. </li>
  2203. </ul>
  2204. <ul class="member-list">
  2205. <h4>See also:</h4>
  2206. <li><tt><a href="../classes/View.html#onmouseenter"><tt>view.onMouseEnter</tt></a></tt></li>
  2207. </ul>
  2208. <h4>Example:<span class="description">When you move the mouse over the item, its fill color is set to red. When you move the mouse outside again, its fill color is set back to black.</span></h4>
  2209. <div class="paperscript split">
  2210. <div class="buttons">
  2211. <div class="button run">Run</div>
  2212. </div>
  2213. <script type="text/paperscript" canvas="canvas-44">
  2214. // Create a circle shaped path at the center of the view:
  2215. var path = new Path.Circle({
  2216. center: view.center,
  2217. radius: 25,
  2218. fillColor: 'black'
  2219. });
  2220. // When the mouse enters the item, set its fill color to red:
  2221. path.onMouseEnter = function(event) {
  2222. this.fillColor = 'red';
  2223. }
  2224. // When the mouse leaves the item, set its fill color to black:
  2225. path.onMouseLeave = function(event) {
  2226. this.fillColor = 'black';
  2227. }
  2228. </script>
  2229. <div class="canvas"><canvas width="516" height="100" id="canvas-44"></canvas></div>
  2230. </div>
  2231. <h4>Example:<span class="description">When you click the mouse, you create new circle shaped items. When you move the mouse over the item, its fill color is set to red. When you move the mouse outside again, its fill color is set back to black.</span></h4>
  2232. <div class="paperscript split">
  2233. <div class="buttons">
  2234. <div class="button run">Run</div>
  2235. </div>
  2236. <script type="text/paperscript" canvas="canvas-45">
  2237. function enter(event) {
  2238. this.fillColor = 'red';
  2239. }
  2240. function leave(event) {
  2241. this.fillColor = 'black';
  2242. }
  2243. // When the mouse is pressed:
  2244. function onMouseDown(event) {
  2245. // Create a circle shaped path at the position of the mouse:
  2246. var path = new Path.Circle(event.point, 25);
  2247. path.fillColor = 'black';
  2248. // When the mouse enters the item, set its fill color to red:
  2249. path.onMouseEnter = enter;
  2250. // When the mouse leaves the item, set its fill color to black:
  2251. path.onMouseLeave = leave;
  2252. }
  2253. </script>
  2254. <div class="canvas"><canvas width="516" height="100" id="canvas-45"></canvas></div>
  2255. </div>
  2256. </div>
  2257. </div>
  2258. </div>
  2259. <div id="onmouseleave" class="member">
  2260. <div class="member-link">
  2261. <a name="onmouseleave" href="#onmouseleave"><tt><b>onMouseLeave</b></tt></a>
  2262. </div>
  2263. <div class="member-description hidden">
  2264. <div class="member-text">
  2265. <p>The function to be called when the mouse moves out of the item. The function receives a <a href="../classes/MouseEvent.html"><tt>MouseEvent</tt></a> object which contains information about the mouse event. Note that such mouse events bubble up the scene graph hierarchy and will reach the view, unless they are stopped with <a href="../classes/Event.html#stoppropagation"><tt>event.stopPropagation</tt></a>() or by returning <code>false</code> from the handler.</p>
  2266. <ul class="member-list">
  2267. <h4>Type:</h4>
  2268. <li>
  2269. <tt>Function</tt>⟋<tt>null</tt>
  2270. </li>
  2271. </ul>
  2272. <ul class="member-list">
  2273. <h4>See also:</h4>
  2274. <li><tt><a href="../classes/View.html#onmouseleave"><tt>view.onMouseLeave</tt></a></tt></li>
  2275. </ul>
  2276. <h4>Example:<span class="description">Move the mouse over the circle shaped path and then move it out of it again to set its fill color to red:</span></h4>
  2277. <div class="paperscript split">
  2278. <div class="buttons">
  2279. <div class="button run">Run</div>
  2280. </div>
  2281. <script type="text/paperscript" canvas="canvas-46">
  2282. // Create a circle shaped path at the center of the view:
  2283. var path = new Path.Circle({
  2284. center: view.center,
  2285. radius: 25,
  2286. fillColor: 'black'
  2287. });
  2288. // When the mouse leaves the item, set its fill color to red:
  2289. path.onMouseLeave = function(event) {
  2290. this.fillColor = 'red';
  2291. }
  2292. </script>
  2293. <div class="canvas"><canvas width="516" height="100" id="canvas-46"></canvas></div>
  2294. </div>
  2295. </div>
  2296. </div>
  2297. </div>
  2298. </div>
  2299. <!-- =========================== inherited methods ========================= -->
  2300. <div class="reference-members"><h2>Methods inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
  2301. <div id="set-props" class="member">
  2302. <div class="member-link">
  2303. <a name="set-props" href="#set-props"><tt><b>set</b>(props)</tt></a>
  2304. </div>
  2305. <div class="member-description hidden">
  2306. <div class="member-text">
  2307. <p>Sets the properties of the passed object literal on this item to the values defined in the object literal, if the item has property of the given name (or a setter defined for it).</p>
  2308. <ul class="member-list">
  2309. <h4>Parameters:</h4>
  2310. <li>
  2311. <tt>props:</tt>
  2312. <tt>Object</tt>
  2313. </li>
  2314. </ul>
  2315. <ul class="member-list">
  2316. <h4>Returns:</h4>
  2317. <li>
  2318. <tt><a href="../classes/Item.html"><tt>Item</tt></a></tt>&nbsp;&mdash;&nbsp;the item itself
  2319. </li>
  2320. </ul>
  2321. <h4>Example:<span class="description">Setting properties through an object literal</span></h4>
  2322. <div class="paperscript split">
  2323. <div class="buttons">
  2324. <div class="button run">Run</div>
  2325. </div>
  2326. <script type="text/paperscript" canvas="canvas-47">
  2327. var circle = new Path.Circle({
  2328. center: [80, 50],
  2329. radius: 35
  2330. });
  2331. circle.set({
  2332. strokeColor: 'red',
  2333. strokeWidth: 10,
  2334. fillColor: 'black',
  2335. selected: true
  2336. });
  2337. </script>
  2338. <div class="canvas"><canvas width="516" height="100" id="canvas-47"></canvas></div>
  2339. </div>
  2340. </div>
  2341. </div>
  2342. </div>
  2343. <div id="clone" class="member">
  2344. <div class="member-link">
  2345. <a name="clone" href="#clone"><tt><b>clone</b>([options])</tt></a>
  2346. </div>
  2347. <div class="member-description hidden">
  2348. <div class="member-text">
  2349. <p>Clones the item within the same project and places the copy above the item.</p>
  2350. <ul class="member-list">
  2351. <h4>Options:</h4>
  2352. <li><tt>insert: undefined</tt> &mdash; specifies whether the copy should be inserted into the scene graph. When set to <code>true</code>, it is inserted above the original &mdash;&nbsp;default: <tt>true</tt></li>
  2353. <li><tt>deep: undefined</tt> &mdash; specifies whether the item&rsquo;s children should also be cloned &mdash;&nbsp;default: <tt>true</tt></li>
  2354. </ul>
  2355. <ul class="member-list">
  2356. <h4>Parameters:</h4>
  2357. <li>
  2358. <tt>options:</tt>
  2359. <tt>Object</tt>
  2360. &mdash;&nbsp;optional, default: <tt>{ insert: true, deep: true }</tt>
  2361. </li>
  2362. </ul>
  2363. <ul class="member-list">
  2364. <h4>Returns:</h4>
  2365. <li>
  2366. <tt><a href="../classes/Item.html"><tt>Item</tt></a></tt>&nbsp;&mdash;&nbsp;the newly cloned item
  2367. </li>
  2368. </ul>
  2369. <h4>Example:<span class="description">Cloning items:</span></h4>
  2370. <div class="paperscript split">
  2371. <div class="buttons">
  2372. <div class="button run">Run</div>
  2373. </div>
  2374. <script type="text/paperscript" canvas="canvas-48">
  2375. var circle = new Path.Circle({
  2376. center: [50, 50],
  2377. radius: 10,
  2378. fillColor: 'red'
  2379. });
  2380. // Make 20 copies of the circle:
  2381. for (var i = 0; i < 20; i++) {
  2382. var copy = circle.clone();
  2383. // Distribute the copies horizontally, so we can see them:
  2384. copy.position.x += i * copy.bounds.width;
  2385. }
  2386. </script>
  2387. <div class="canvas"><canvas width="516" height="100" id="canvas-48"></canvas></div>
  2388. </div>
  2389. </div>
  2390. </div>
  2391. </div>
  2392. <div id="copycontent-source" class="member">
  2393. <div class="member-link">
  2394. <a name="copycontent-source" href="#copycontent-source"><tt><b>copyContent</b>(source)</tt></a>
  2395. </div>
  2396. <div class="member-description hidden">
  2397. <div class="member-text">
  2398. <p>Copies the content of the specified item over to this item.</p>
  2399. <ul class="member-list">
  2400. <h4>Parameters:</h4>
  2401. <li>
  2402. <tt>source:</tt>
  2403. <a href="../classes/Item.html"><tt>Item</tt></a>
  2404. &mdash;&nbsp;the item to copy the content from
  2405. </li>
  2406. </ul>
  2407. </div>
  2408. </div>
  2409. </div>
  2410. <div id="copyattributes-source-excludeMatrix" class="member">
  2411. <div class="member-link">
  2412. <a name="copyattributes-source-excludeMatrix" href="#copyattributes-source-excludeMatrix"><tt><b>copyAttributes</b>(source, excludeMatrix)</tt></a>
  2413. </div>
  2414. <div class="member-description hidden">
  2415. <div class="member-text">
  2416. <p>Copies all attributes of the specified item over to this item. This includes its style, visibility, matrix, pivot, blend-mode, opacity, selection state, data, name, etc.</p>
  2417. <ul class="member-list">
  2418. <h4>Parameters:</h4>
  2419. <li>
  2420. <tt>source:</tt>
  2421. <a href="../classes/Item.html"><tt>Item</tt></a>
  2422. &mdash;&nbsp;the item to copy the attributes from
  2423. </li>
  2424. <li>
  2425. <tt>excludeMatrix:</tt>
  2426. <tt>Boolean</tt>
  2427. &mdash;&nbsp;whether to exclude the transformation matrix when copying all attributes
  2428. </li>
  2429. </ul>
  2430. </div>
  2431. </div>
  2432. </div>
  2433. <div id="rasterize" class="member">
  2434. <div class="member-link">
  2435. <a name="rasterize" href="#rasterize"><tt><b>rasterize</b>([options])</tt></a>
  2436. </div>
  2437. <div class="member-description hidden">
  2438. <div class="member-text">
  2439. <p>Rasterizes the item into a newly created Raster object. The item itself is not removed after rasterization.</p>
  2440. <ul class="member-list">
  2441. <h4>Options:</h4>
  2442. <li><tt>resolution: <tt>Number</tt></tt> &mdash; the desired resolution to be used when rasterizing, in pixels per inch (DPI). If not specified, the value of <code>view.resolution</code> is used by default. &mdash;&nbsp;default: <tt>view.resolution</tt></li>
  2443. <li><tt>raster: <a href="../classes/Raster.html"><tt>Raster</tt></a></tt> &mdash; specifies a raster to be reused when rasterizing. If the raster has the desired size already, then the underlying canvas is reused and no new memory needs to be allocated. If no raster is provided, a new raster item is created and returned instead. &mdash;&nbsp;default: <tt>null</tt></li>
  2444. <li><tt>insert: <tt>Boolean</tt></tt> &mdash; specifies whether the raster should be inserted into the scene graph. When set to <code>true</code>, it is inserted above the rasterized item. &mdash;&nbsp;default: <tt>true</tt></li>
  2445. </ul>
  2446. <ul class="member-list">
  2447. <h4>Parameters:</h4>
  2448. <li>
  2449. <tt>options:</tt>
  2450. <tt>Object</tt>
  2451. &mdash;&nbsp;the rasterization options
  2452. &mdash;&nbsp;optional, default: <tt>{}</tt>
  2453. </li>
  2454. </ul>
  2455. <ul class="member-list">
  2456. <h4>Returns:</h4>
  2457. <li>
  2458. <tt><a href="../classes/Raster.html"><tt>Raster</tt></a></tt>&nbsp;&mdash;&nbsp;the reused raster or the newly created raster item
  2459. </li>
  2460. </ul>
  2461. <h4>Example:<span class="description">Rasterizing an item:</span></h4>
  2462. <div class="paperscript split">
  2463. <div class="buttons">
  2464. <div class="button run">Run</div>
  2465. </div>
  2466. <script type="text/paperscript" canvas="canvas-49">
  2467. var circle = new Path.Circle({
  2468. center: [50, 50],
  2469. radius: 5,
  2470. fillColor: 'red'
  2471. });
  2472. // Create a rasterized version of the path:
  2473. var raster = circle.rasterize();
  2474. // Move it 100pt to the right:
  2475. raster.position.x += 100;
  2476. // Scale the path and the raster by 300%, so we can compare them:
  2477. circle.scale(5);
  2478. raster.scale(5);
  2479. </script>
  2480. <div class="canvas"><canvas width="516" height="100" id="canvas-49"></canvas></div>
  2481. </div>
  2482. </div>
  2483. </div>
  2484. </div>
  2485. <h3>Geometric Tests</h3>
  2486. <div id="contains-point" class="member">
  2487. <div class="member-link">
  2488. <a name="contains-point" href="#contains-point"><tt><b>contains</b>(point)</tt></a>
  2489. </div>
  2490. <div class="member-description hidden">
  2491. <div class="member-text">
  2492. <p>Checks whether the item&rsquo;s geometry contains the given point.</p>
  2493. <ul class="member-list">
  2494. <h4>Parameters:</h4>
  2495. <li>
  2496. <tt>point:</tt>
  2497. <a href="../classes/Point.html"><tt>Point</tt></a>
  2498. &mdash;&nbsp;the point to check for
  2499. </li>
  2500. </ul>
  2501. <ul class="member-list">
  2502. <h4>Returns:</h4>
  2503. <li>
  2504. <tt><tt>Boolean</tt></tt>
  2505. </li>
  2506. </ul>
  2507. <h4>Example:<span class="description">Click within and outside the star below Create a star shaped path:</span></h4>
  2508. <div class="paperscript split">
  2509. <div class="buttons">
  2510. <div class="button run">Run</div>
  2511. </div>
  2512. <script type="text/paperscript" canvas="canvas-50">
  2513. var path = new Path.Star({
  2514. center: [50, 50],
  2515. points: 12,
  2516. radius1: 20,
  2517. radius2: 40,
  2518. fillColor: 'black'
  2519. });
  2520. // Whenever the user presses the mouse:
  2521. function onMouseDown(event) {
  2522. // If the position of the mouse is within the path,
  2523. // set its fill color to red, otherwise set it to
  2524. // black:
  2525. if (path.contains(event.point)) {
  2526. path.fillColor = 'red';
  2527. } else {
  2528. path.fillColor = 'black';
  2529. }
  2530. }
  2531. </script>
  2532. <div class="canvas"><canvas width="516" height="100" id="canvas-50"></canvas></div>
  2533. </div>
  2534. </div>
  2535. </div>
  2536. </div>
  2537. <div id="isinside-rect" class="member">
  2538. <div class="member-link">
  2539. <a name="isinside-rect" href="#isinside-rect"><tt><b>isInside</b>(rect)</tt></a>
  2540. </div>
  2541. <div class="member-description hidden">
  2542. <div class="member-text">
  2543. <ul class="member-list">
  2544. <h4>Parameters:</h4>
  2545. <li>
  2546. <tt>rect:</tt>
  2547. <a href="../classes/Rectangle.html"><tt>Rectangle</tt></a>
  2548. &mdash;&nbsp;the rectangle to check against
  2549. </li>
  2550. </ul>
  2551. <ul class="member-list">
  2552. <h4>Returns:</h4>
  2553. <li>
  2554. <tt><tt>Boolean</tt></tt>
  2555. </li>
  2556. </ul>
  2557. </div>
  2558. </div>
  2559. </div>
  2560. <div id="intersects-item" class="member">
  2561. <div class="member-link">
  2562. <a name="intersects-item" href="#intersects-item"><tt><b>intersects</b>(item)</tt></a>
  2563. </div>
  2564. <div class="member-description hidden">
  2565. <div class="member-text">
  2566. <ul class="member-list">
  2567. <h4>Parameters:</h4>
  2568. <li>
  2569. <tt>item:</tt>
  2570. <a href="../classes/Item.html"><tt>Item</tt></a>
  2571. &mdash;&nbsp;the item to check against
  2572. </li>
  2573. </ul>
  2574. <ul class="member-list">
  2575. <h4>Returns:</h4>
  2576. <li>
  2577. <tt><tt>Boolean</tt></tt>
  2578. </li>
  2579. </ul>
  2580. </div>
  2581. </div>
  2582. </div>
  2583. <h3>Hit-testing, Fetching and Matching Items</h3>
  2584. <div id="hittest-point" class="member">
  2585. <div class="member-link">
  2586. <a name="hittest-point" href="#hittest-point"><tt><b>hitTest</b>(point[, options])</tt></a>
  2587. </div>
  2588. <div class="member-description hidden">
  2589. <div class="member-text">
  2590. <p>Performs a hit-test on the item and its children (if it is a <a href="../classes/Group.html"><tt>Group</tt></a> or <a href="../classes/Layer.html"><tt>Layer</tt></a>) at the location of the specified point, returning the first found hit.</p>
  2591. <p>The options object allows you to control the specifics of the hit- test and may contain a combination of the following values:</p>
  2592. <ul class="member-list">
  2593. <h4>Options:</h4>
  2594. <li><tt>options.tolerance: <tt>Number</tt></tt> &mdash; the tolerance of the hit-test &mdash;&nbsp;default: <tt><a href="../classes/PaperScope.html#settings"><tt>paperScope.settings</tt></a>.hitTolerance</tt></li>
  2595. <li><tt>options.class: <tt>Function</tt></tt> &mdash; only hit-test against a specific item class, or any of its sub-classes, by providing the constructor function against which an <code>instanceof</code> check is performed: <tt>Group</tt>, <tt>Layer</tt>, <tt>Path</tt>, <tt>CompoundPath</tt>, <tt>Shape</tt>, <tt>Raster</tt>, <tt>SymbolItem</tt>, <tt>PointText</tt>, &hellip;</li>
  2596. <li><tt>options.match: <tt>Function</tt></tt> &mdash; a match function to be called for each found hit result: Return <code>true</code> to return the result, <code>false</code> to keep searching</li>
  2597. <li><tt>options.fill: <tt>Boolean</tt></tt> &mdash; hit-test the fill of items &mdash;&nbsp;default: <tt>true</tt></li>
  2598. <li><tt>options.stroke: <tt>Boolean</tt></tt> &mdash; hit-test the stroke of path items, taking into account the setting of stroke color and width &mdash;&nbsp;default: <tt>true</tt></li>
  2599. <li><tt>options.segments: <tt>Boolean</tt></tt> &mdash; hit-test for <a href="../classes/Segment.html#point"><tt>segment.point</tt></a> of <a href="../classes/Path.html"><tt>Path</tt></a> items &mdash;&nbsp;default: <tt>true</tt></li>
  2600. <li><tt>options.curves: <tt>Boolean</tt></tt> &mdash; hit-test the curves of path items, without taking the stroke color or width into account</li>
  2601. <li><tt>options.handles: <tt>Boolean</tt></tt> &mdash; hit-test for the handles (<a href="../classes/Segment.html#handlein"><tt>segment.handleIn</tt></a> / <a href="../classes/Segment.html#handleout"><tt>segment.handleOut</tt></a>) of path segments.</li>
  2602. <li><tt>options.ends: <tt>Boolean</tt></tt> &mdash; only hit-test for the first or last segment points of open path items</li>
  2603. <li><tt>options.position: <tt>Boolean</tt></tt> &mdash; hit-test the <a href="../classes/Item.html#position"><tt>item.position</tt></a> of of items, which depends on the setting of <a href="../classes/Item.html#pivot"><tt>item.pivot</tt></a></li>
  2604. <li><tt>options.center: <tt>Boolean</tt></tt> &mdash; hit-test the <a href="../classes/Rectangle.html#center"><tt>rectangle.center</tt></a> of the bounding rectangle of items (<a href="../classes/Item.html#bounds"><tt>item.bounds</tt></a>)</li>
  2605. <li><tt>options.bounds: <tt>Boolean</tt></tt> &mdash; hit-test the corners and side-centers of the bounding rectangle of items (<a href="../classes/Item.html#bounds"><tt>item.bounds</tt></a>)</li>
  2606. <li><tt>options.guides: <tt>Boolean</tt></tt> &mdash; hit-test items that have <tt>Item#guide</tt> set to <code>true</code></li>
  2607. <li><tt>options.selected: <tt>Boolean</tt></tt> &mdash; only hit selected items</li>
  2608. </ul>
  2609. <ul class="member-list">
  2610. <h4>Parameters:</h4>
  2611. <li>
  2612. <tt>point:</tt>
  2613. <a href="../classes/Point.html"><tt>Point</tt></a>
  2614. &mdash;&nbsp;the point where the hit-test should be performed (in global coordinates system).
  2615. </li>
  2616. <li>
  2617. <tt>options:</tt>
  2618. <tt>Object</tt>
  2619. &mdash;&nbsp;optional, default: <tt>{ fill: true, stroke: true, segments: true, tolerance: settings.hitTolerance }</tt>
  2620. </li>
  2621. </ul>
  2622. <ul class="member-list">
  2623. <h4>Returns:</h4>
  2624. <li>
  2625. <tt><a href="../classes/HitResult.html"><tt>HitResult</tt></a></tt>&nbsp;&mdash;&nbsp;a hit result object describing what exactly was hit or <code>null</code> if nothing was hit
  2626. </li>
  2627. </ul>
  2628. </div>
  2629. </div>
  2630. </div>
  2631. <div id="hittestall-point" class="member">
  2632. <div class="member-link">
  2633. <a name="hittestall-point" href="#hittestall-point"><tt><b>hitTestAll</b>(point[, options])</tt></a>
  2634. </div>
  2635. <div class="member-description hidden">
  2636. <div class="member-text">
  2637. <p>Performs a hit-test on the item and its children (if it is a <a href="../classes/Group.html"><tt>Group</tt></a> or <a href="../classes/Layer.html"><tt>Layer</tt></a>) at the location of the specified point, returning all found hits.</p>
  2638. <p>The options object allows you to control the specifics of the hit- test. See <a href="../classes/Item.html#hittest-point"><tt>hitTest(point[, options])</tt></a> for a list of all options.</p>
  2639. <ul class="member-list">
  2640. <h4>Parameters:</h4>
  2641. <li>
  2642. <tt>point:</tt>
  2643. <a href="../classes/Point.html"><tt>Point</tt></a>
  2644. &mdash;&nbsp;the point where the hit-test should be performed (in global coordinates system).
  2645. </li>
  2646. <li>
  2647. <tt>options:</tt>
  2648. <tt>Object</tt>
  2649. &mdash;&nbsp;optional, default: <tt>{ fill: true, stroke: true, segments: true, tolerance: settings.hitTolerance }</tt>
  2650. </li>
  2651. </ul>
  2652. <ul class="member-list">
  2653. <h4>Returns:</h4>
  2654. <li>
  2655. <tt>Array of <a href="../classes/HitResult.html"><tt>HitResult</tt></a> objects</tt>&nbsp;&mdash;&nbsp;hit result objects for all hits, describing what exactly was hit or <code>null</code> if nothing was hit
  2656. </li>
  2657. </ul>
  2658. <ul class="member-list">
  2659. <h4>See also:</h4>
  2660. <li><tt><a href="../classes/Item.html#hittest-point"><tt>hitTest(point[, options])</tt></a>;</tt></li>
  2661. </ul>
  2662. </div>
  2663. </div>
  2664. </div>
  2665. <div id="matches-options" class="member">
  2666. <div class="member-link">
  2667. <a name="matches-options" href="#matches-options"><tt><b>matches</b>(options)</tt></a>
  2668. </div>
  2669. <div class="member-description hidden">
  2670. <div class="member-text">
  2671. <p>Checks whether the item matches the criteria described by the given object, by iterating over all of its properties and matching against their values through <a href="../classes/Item.html#matches-name-compare"><tt>matches(name, compare)</tt></a>.</p>
  2672. <p>See <a href="../classes/Project.html#getitems-options"><tt>project.getItems(options)</tt></a> for a selection of illustrated examples.</p>
  2673. <ul class="member-list">
  2674. <h4>Parameters:</h4>
  2675. <li>
  2676. <tt>options:</tt>
  2677. <tt>Object</tt>⟋<tt>Function</tt>
  2678. &mdash;&nbsp;the criteria to match against
  2679. </li>
  2680. </ul>
  2681. <ul class="member-list">
  2682. <h4>Returns:</h4>
  2683. <li>
  2684. <tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;<tt>true</tt> if the item matches all the criteria, <tt>false</tt> otherwise
  2685. </li>
  2686. </ul>
  2687. <ul class="member-list">
  2688. <h4>See also:</h4>
  2689. <li><tt><a href="../classes/Item.html#getitems-options"><tt>getItems(options)</tt></a></tt></li>
  2690. </ul>
  2691. </div>
  2692. </div>
  2693. </div>
  2694. <div id="matches-name-compare" class="member">
  2695. <div class="member-link">
  2696. <a name="matches-name-compare" href="#matches-name-compare"><tt><b>matches</b>(name, compare)</tt></a>
  2697. </div>
  2698. <div class="member-description hidden">
  2699. <div class="member-text">
  2700. <p>Checks whether the item matches the given criteria. Extended matching is possible by providing a compare function or a regular expression. Matching points, colors only work as a comparison of the full object, not partial matching (e.g. only providing the x-coordinate to match all points with that x-value). Partial matching does work for <a href="../classes/Item.html#data"><tt>item.data</tt></a>.</p>
  2701. <p>See <a href="../classes/Project.html#getitems-options"><tt>project.getItems(options)</tt></a> for a selection of illustrated examples.</p>
  2702. <ul class="member-list">
  2703. <h4>Parameters:</h4>
  2704. <li>
  2705. <tt>name:</tt>
  2706. <tt>String</tt>
  2707. &mdash;&nbsp;the name of the state to match against
  2708. </li>
  2709. <li>
  2710. <tt>compare:</tt>
  2711. <tt>Object</tt>
  2712. &mdash;&nbsp;the value, function or regular expression to compare against
  2713. </li>
  2714. </ul>
  2715. <ul class="member-list">
  2716. <h4>Returns:</h4>
  2717. <li>
  2718. <tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;<tt>true</tt> if the item matches the state, <tt>false</tt> otherwise
  2719. </li>
  2720. </ul>
  2721. <ul class="member-list">
  2722. <h4>See also:</h4>
  2723. <li><tt><a href="../classes/Item.html#getitems-options"><tt>getItems(options)</tt></a></tt></li>
  2724. </ul>
  2725. </div>
  2726. </div>
  2727. </div>
  2728. <div id="getitems-options" class="member">
  2729. <div class="member-link">
  2730. <a name="getitems-options" href="#getitems-options"><tt><b>getItems</b>(options)</tt></a>
  2731. </div>
  2732. <div class="member-description hidden">
  2733. <div class="member-text">
  2734. <p>Fetch the descendants (children or children of children) of this item that match the properties in the specified object. Extended matching is possible by providing a compare function or regular expression. Matching points, colors only work as a comparison of the full object, not partial matching (e.g. only providing the x- coordinate to match all points with that x-value). Partial matching does work for <a href="../classes/Item.html#data"><tt>item.data</tt></a>.</p>
  2735. <p>Matching items against a rectangular area is also possible, by setting either <code>options.inside</code> or <code>options.overlapping</code> to a rectangle describing the area in which the items either have to be fully or partly contained.</p>
  2736. <p>See <a href="../classes/Project.html#getitems-options"><tt>project.getItems(options)</tt></a> for a selection of illustrated examples.</p>
  2737. <ul class="member-list">
  2738. <h4>Options:</h4>
  2739. <li><tt>options.recursive: <tt>Boolean</tt></tt> &mdash; whether to loop recursively through all children, or stop at the current level &mdash;&nbsp;default: <tt>true</tt></li>
  2740. <li><tt>options.match: <tt>Function</tt></tt> &mdash; a match function to be called for each item, allowing the definition of more flexible item checks that are not bound to properties. If no other match properties are defined, this function can also be passed instead of the <code>options</code> object</li>
  2741. <li><tt>options.class: <tt>Function</tt></tt> &mdash; the constructor function of the item type to match against</li>
  2742. <li><tt>options.inside: <a href="../classes/Rectangle.html"><tt>Rectangle</tt></a></tt> &mdash; the rectangle in which the items need to be fully contained</li>
  2743. <li><tt>options.overlapping: <a href="../classes/Rectangle.html"><tt>Rectangle</tt></a></tt> &mdash; the rectangle with which the items need to at least partly overlap</li>
  2744. </ul>
  2745. <ul class="member-list">
  2746. <h4>Parameters:</h4>
  2747. <li>
  2748. <tt>options:</tt>
  2749. <tt>Object</tt>⟋<tt>Function</tt>
  2750. &mdash;&nbsp;the criteria to match against
  2751. </li>
  2752. </ul>
  2753. <ul class="member-list">
  2754. <h4>Returns:</h4>
  2755. <li>
  2756. <tt>Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects</tt>&nbsp;&mdash;&nbsp;the list of matching descendant items
  2757. </li>
  2758. </ul>
  2759. <ul class="member-list">
  2760. <h4>See also:</h4>
  2761. <li><tt><a href="../classes/Item.html#matches-options"><tt>matches(options)</tt></a></tt></li>
  2762. </ul>
  2763. </div>
  2764. </div>
  2765. </div>
  2766. <div id="getitem-options" class="member">
  2767. <div class="member-link">
  2768. <a name="getitem-options" href="#getitem-options"><tt><b>getItem</b>(options)</tt></a>
  2769. </div>
  2770. <div class="member-description hidden">
  2771. <div class="member-text">
  2772. <p>Fetch the first descendant (child or child of child) of this item that matches the properties in the specified object. Extended matching is possible by providing a compare function or regular expression. Matching points, colors only work as a comparison of the full object, not partial matching (e.g. only providing the x- coordinate to match all points with that x-value). Partial matching does work for <a href="../classes/Item.html#data"><tt>item.data</tt></a>. See <a href="../classes/Project.html#getitems-match"><tt>project.getItems(match)</tt></a> for a selection of illustrated examples.</p>
  2773. <ul class="member-list">
  2774. <h4>Parameters:</h4>
  2775. <li>
  2776. <tt>options:</tt>
  2777. <tt>Object</tt>⟋<tt>Function</tt>
  2778. &mdash;&nbsp;the criteria to match against
  2779. </li>
  2780. </ul>
  2781. <ul class="member-list">
  2782. <h4>Returns:</h4>
  2783. <li>
  2784. <tt><a href="../classes/Item.html"><tt>Item</tt></a></tt>&nbsp;&mdash;&nbsp;the first descendant item matching the given criteria
  2785. </li>
  2786. </ul>
  2787. <ul class="member-list">
  2788. <h4>See also:</h4>
  2789. <li><tt><a href="../classes/Item.html#getitems-options"><tt>getItems(options)</tt></a></tt></li>
  2790. </ul>
  2791. </div>
  2792. </div>
  2793. </div>
  2794. <h3>Importing / Exporting JSON and SVG</h3>
  2795. <div id="exportjson" class="member">
  2796. <div class="member-link">
  2797. <a name="exportjson" href="#exportjson"><tt><b>exportJSON</b>([options])</tt></a>
  2798. </div>
  2799. <div class="member-description hidden">
  2800. <div class="member-text">
  2801. <p>Exports (serializes) the item with its content and child items to a JSON data string.</p>
  2802. <ul class="member-list">
  2803. <h4>Options:</h4>
  2804. <li><tt>options.asString: <tt>Boolean</tt></tt> &mdash; whether the JSON is returned as a <code>Object</code> or a <code>String</code> &mdash;&nbsp;default: <tt>true</tt></li>
  2805. <li><tt>options.precision: <tt>Number</tt></tt> &mdash; the amount of fractional digits in numbers used in JSON data &mdash;&nbsp;default: <tt>5</tt></li>
  2806. </ul>
  2807. <ul class="member-list">
  2808. <h4>Parameters:</h4>
  2809. <li>
  2810. <tt>options:</tt>
  2811. <tt>Object</tt>
  2812. &mdash;&nbsp;the serialization options
  2813. &mdash;&nbsp;optional
  2814. </li>
  2815. </ul>
  2816. <ul class="member-list">
  2817. <h4>Returns:</h4>
  2818. <li>
  2819. <tt><tt>String</tt></tt>&nbsp;&mdash;&nbsp;the exported JSON data
  2820. </li>
  2821. </ul>
  2822. </div>
  2823. </div>
  2824. </div>
  2825. <div id="importjson-json" class="member">
  2826. <div class="member-link">
  2827. <a name="importjson-json" href="#importjson-json"><tt><b>importJSON</b>(json)</tt></a>
  2828. </div>
  2829. <div class="member-description hidden">
  2830. <div class="member-text">
  2831. <p>Imports (deserializes) the stored JSON data into this item. If the data describes an item of the same class or a parent class of the item, the data is imported into the item itself. If not, the imported item is added to this item&rsquo;s <a href="../classes/Item.html#children"><tt>item.children</tt></a> list. Note that not all type of items can have children.</p>
  2832. <ul class="member-list">
  2833. <h4>Parameters:</h4>
  2834. <li>
  2835. <tt>json:</tt>
  2836. <tt>String</tt>
  2837. &mdash;&nbsp;the JSON data to import from
  2838. </li>
  2839. </ul>
  2840. <ul class="member-list">
  2841. <h4>Returns:</h4>
  2842. <li>
  2843. <tt><a href="../classes/Item.html"><tt>Item</tt></a></tt>
  2844. </li>
  2845. </ul>
  2846. </div>
  2847. </div>
  2848. </div>
  2849. <div id="exportsvg" class="member">
  2850. <div class="member-link">
  2851. <a name="exportsvg" href="#exportsvg"><tt><b>exportSVG</b>([options])</tt></a>
  2852. </div>
  2853. <div class="member-description hidden">
  2854. <div class="member-text">
  2855. <p>Exports the item with its content and child items as an SVG DOM.</p>
  2856. <ul class="member-list">
  2857. <h4>Options:</h4>
  2858. <li><tt>options.bounds: <tt>String</tt>⟋<a href="../classes/Rectangle.html"><tt>Rectangle</tt></a></tt> &mdash; the bounds of the area to export, either as a string (<tt>&lsquo;view&rsquo;</tt>, <tt>content&rsquo;</tt>), or a <a href="../classes/Rectangle.html"><tt>Rectangle</tt></a> object: <code>&#39;view&#39;</code> uses the view bounds, <code>&#39;content&#39;</code> uses the stroke bounds of all content &mdash;&nbsp;default: <tt>&lsquo;view&rsquo;</tt></li>
  2859. <li><tt>options.matrix: <a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt> &mdash; the matrix with which to transform the exported content: If <code>options.bounds</code> is set to <code>&#39;view&#39;</code>, <code>paper.view.matrix</code> is used, for all other settings of <code>options.bounds</code> the identity matrix is used. &mdash;&nbsp;default: <tt>paper.view.matrix</tt></li>
  2860. <li><tt>options.asString: <tt>Boolean</tt></tt> &mdash; whether a SVG node or a <code>String</code> is to be returned &mdash;&nbsp;default: <tt>false</tt></li>
  2861. <li><tt>options.precision: <tt>Number</tt></tt> &mdash; the amount of fractional digits in numbers used in SVG data &mdash;&nbsp;default: <tt>5</tt></li>
  2862. <li><tt>options.matchShapes: <tt>Boolean</tt></tt> &mdash; whether path items should tried to be converted to SVG shape items (rect, circle, ellipse, line, polyline, polygon), if their geometries match &mdash;&nbsp;default: <tt>false</tt></li>
  2863. <li><tt>options.embedImages: <tt>Boolean</tt></tt> &mdash; whether raster images should be embedded as base64 data inlined in the xlink:href attribute, or kept as a link to their external URL. &mdash;&nbsp;default: <tt>true</tt></li>
  2864. </ul>
  2865. <ul class="member-list">
  2866. <h4>Parameters:</h4>
  2867. <li>
  2868. <tt>options:</tt>
  2869. <tt>Object</tt>
  2870. &mdash;&nbsp;the export options
  2871. &mdash;&nbsp;optional
  2872. </li>
  2873. </ul>
  2874. <ul class="member-list">
  2875. <h4>Returns:</h4>
  2876. <li>
  2877. <tt><tt>SVGElement</tt>⟋<tt>String</tt></tt>&nbsp;&mdash;&nbsp;the item converted to an SVG node or a <code>String</code> depending on <code>option.asString</code> value
  2878. </li>
  2879. </ul>
  2880. </div>
  2881. </div>
  2882. </div>
  2883. <div id="importsvg-svg" class="member">
  2884. <div class="member-link">
  2885. <a name="importsvg-svg" href="#importsvg-svg"><tt><b>importSVG</b>(svg[, options])</tt></a>
  2886. </div>
  2887. <div class="member-description hidden">
  2888. <div class="member-text">
  2889. <p>Converts the provided SVG content into Paper.js items and adds them to the this item&rsquo;s children list. Note that the item is not cleared first. You can call <a href="../classes/Item.html#removechildren"><tt>item.removeChildren</tt></a>() to do so.</p>
  2890. <ul class="member-list">
  2891. <h4>Options:</h4>
  2892. <li><tt>options.expandShapes: <tt>Boolean</tt></tt> &mdash; whether imported shape items should be expanded to path items &mdash;&nbsp;default: <tt>false</tt></li>
  2893. <li><tt>options.onLoad: <tt>Function</tt></tt> &mdash; the callback function to call once the SVG content is loaded from the given URL receiving two arguments: the converted <code>item</code> and the original <code>svg</code> data as a string. Only required when loading from external resources.</li>
  2894. <li><tt>options.onError: <tt>Function</tt></tt> &mdash; the callback function to call if an error occurs during loading. Only required when loading from external resources.</li>
  2895. <li><tt>options.insert: <tt>Boolean</tt></tt> &mdash; whether the imported items should be added to the item that <code>importSVG()</code> is called on &mdash;&nbsp;default: <tt>true</tt></li>
  2896. <li><tt>options.applyMatrix: <tt>Boolean</tt></tt> &mdash; whether the imported items should have their transformation matrices applied to their contents or not &mdash;&nbsp;default: <tt><a href="../classes/PaperScope.html#settings"><tt>paperScope.settings</tt></a>.applyMatrix</tt></li>
  2897. </ul>
  2898. <ul class="member-list">
  2899. <h4>Parameters:</h4>
  2900. <li>
  2901. <tt>svg:</tt>
  2902. <tt>SVGElement</tt>⟋<tt>String</tt>
  2903. &mdash;&nbsp;the SVG content to import, either as a SVG DOM node, a string containing SVG content, or a string describing the URL of the SVG file to fetch.
  2904. </li>
  2905. <li>
  2906. <tt>options:</tt>
  2907. <tt>Object</tt>
  2908. &mdash;&nbsp;the import options
  2909. &mdash;&nbsp;optional
  2910. </li>
  2911. </ul>
  2912. <ul class="member-list">
  2913. <h4>Returns:</h4>
  2914. <li>
  2915. <tt><a href="../classes/Item.html"><tt>Item</tt></a></tt>&nbsp;&mdash;&nbsp;the newly created Paper.js item containing the converted SVG content
  2916. </li>
  2917. </ul>
  2918. </div>
  2919. </div>
  2920. </div>
  2921. <div id="importsvg-svg-onLoad" class="member">
  2922. <div class="member-link">
  2923. <a name="importsvg-svg-onLoad" href="#importsvg-svg-onLoad"><tt><b>importSVG</b>(svg, onLoad)</tt></a>
  2924. </div>
  2925. <div class="member-description hidden">
  2926. <div class="member-text">
  2927. <p>Imports the provided external SVG file, converts it into Paper.js items and adds them to the this item&rsquo;s children list. Note that the item is not cleared first. You can call <a href="../classes/Item.html#removechildren"><tt>item.removeChildren</tt></a>() to do so.</p>
  2928. <ul class="member-list">
  2929. <h4>Parameters:</h4>
  2930. <li>
  2931. <tt>svg:</tt>
  2932. <tt>SVGElement</tt>⟋<tt>String</tt>
  2933. &mdash;&nbsp;the URL of the SVG file to fetch.
  2934. </li>
  2935. <li>
  2936. <tt>onLoad:</tt>
  2937. <tt>Function</tt>
  2938. &mdash;&nbsp;the callback function to call once the SVG content is loaded from the given URL receiving two arguments: the converted <code>item</code> and the original <code>svg</code> data as a string. Only required when loading from external files.
  2939. </li>
  2940. </ul>
  2941. <ul class="member-list">
  2942. <h4>Returns:</h4>
  2943. <li>
  2944. <tt><a href="../classes/Item.html"><tt>Item</tt></a></tt>&nbsp;&mdash;&nbsp;the newly created Paper.js item containing the converted SVG content
  2945. </li>
  2946. </ul>
  2947. </div>
  2948. </div>
  2949. </div>
  2950. <h3>Hierarchy Operations</h3>
  2951. <div id="addchild-item" class="member">
  2952. <div class="member-link">
  2953. <a name="addchild-item" href="#addchild-item"><tt><b>addChild</b>(item)</tt></a>
  2954. </div>
  2955. <div class="member-description hidden">
  2956. <div class="member-text">
  2957. <p>Adds the specified item as a child of this item at the end of the its <a href="../classes/Item.html#children"><tt>children</tt></a> list. You can use this function for groups, compound paths and layers.</p>
  2958. <ul class="member-list">
  2959. <h4>Parameters:</h4>
  2960. <li>
  2961. <tt>item:</tt>
  2962. <a href="../classes/Item.html"><tt>Item</tt></a>
  2963. &mdash;&nbsp;the item to be added as a child
  2964. </li>
  2965. </ul>
  2966. <ul class="member-list">
  2967. <h4>Returns:</h4>
  2968. <li>
  2969. <tt><a href="../classes/Item.html"><tt>Item</tt></a></tt>&nbsp;&mdash;&nbsp;the added item, or <code>null</code> if adding was not possible
  2970. </li>
  2971. </ul>
  2972. </div>
  2973. </div>
  2974. </div>
  2975. <div id="insertchild-index-item" class="member">
  2976. <div class="member-link">
  2977. <a name="insertchild-index-item" href="#insertchild-index-item"><tt><b>insertChild</b>(index, item)</tt></a>
  2978. </div>
  2979. <div class="member-description hidden">
  2980. <div class="member-text">
  2981. <p>Inserts the specified item as a child of this item at the specified index in its <a href="../classes/Item.html#children"><tt>children</tt></a> list. You can use this function for groups, compound paths and layers.</p>
  2982. <ul class="member-list">
  2983. <h4>Parameters:</h4>
  2984. <li>
  2985. <tt>index:</tt>
  2986. <tt>Number</tt>
  2987. &mdash;&nbsp;the index at which to insert the item
  2988. </li>
  2989. <li>
  2990. <tt>item:</tt>
  2991. <a href="../classes/Item.html"><tt>Item</tt></a>
  2992. &mdash;&nbsp;the item to be inserted as a child
  2993. </li>
  2994. </ul>
  2995. <ul class="member-list">
  2996. <h4>Returns:</h4>
  2997. <li>
  2998. <tt><a href="../classes/Item.html"><tt>Item</tt></a></tt>&nbsp;&mdash;&nbsp;the inserted item, or <code>null</code> if inserting was not possible
  2999. </li>
  3000. </ul>
  3001. </div>
  3002. </div>
  3003. </div>
  3004. <div id="addchildren-items" class="member">
  3005. <div class="member-link">
  3006. <a name="addchildren-items" href="#addchildren-items"><tt><b>addChildren</b>(items)</tt></a>
  3007. </div>
  3008. <div class="member-description hidden">
  3009. <div class="member-text">
  3010. <p>Adds the specified items as children of this item at the end of the its children list. You can use this function for groups, compound paths and layers.</p>
  3011. <ul class="member-list">
  3012. <h4>Parameters:</h4>
  3013. <li>
  3014. <tt>items:</tt>
  3015. Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
  3016. &mdash;&nbsp;the items to be added as children
  3017. </li>
  3018. </ul>
  3019. <ul class="member-list">
  3020. <h4>Returns:</h4>
  3021. <li>
  3022. <tt>Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects</tt>&nbsp;&mdash;&nbsp;the added items, or <code>null</code> if adding was not possible
  3023. </li>
  3024. </ul>
  3025. </div>
  3026. </div>
  3027. </div>
  3028. <div id="insertchildren-index-items" class="member">
  3029. <div class="member-link">
  3030. <a name="insertchildren-index-items" href="#insertchildren-index-items"><tt><b>insertChildren</b>(index, items)</tt></a>
  3031. </div>
  3032. <div class="member-description hidden">
  3033. <div class="member-text">
  3034. <p>Inserts the specified items as children of this item at the specified index in its <a href="../classes/Item.html#children"><tt>children</tt></a> list. You can use this function for groups, compound paths and layers.</p>
  3035. <ul class="member-list">
  3036. <h4>Parameters:</h4>
  3037. <li>
  3038. <tt>index:</tt>
  3039. <tt>Number</tt>
  3040. </li>
  3041. <li>
  3042. <tt>items:</tt>
  3043. Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
  3044. &mdash;&nbsp;the items to be appended as children
  3045. </li>
  3046. </ul>
  3047. <ul class="member-list">
  3048. <h4>Returns:</h4>
  3049. <li>
  3050. <tt>Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects</tt>&nbsp;&mdash;&nbsp;the inserted items, or <code>null</code> if inserted was not possible
  3051. </li>
  3052. </ul>
  3053. </div>
  3054. </div>
  3055. </div>
  3056. <div id="insertabove-item" class="member">
  3057. <div class="member-link">
  3058. <a name="insertabove-item" href="#insertabove-item"><tt><b>insertAbove</b>(item)</tt></a>
  3059. </div>
  3060. <div class="member-description hidden">
  3061. <div class="member-text">
  3062. <p>Inserts this item above the specified item.</p>
  3063. <ul class="member-list">
  3064. <h4>Parameters:</h4>
  3065. <li>
  3066. <tt>item:</tt>
  3067. <a href="../classes/Item.html"><tt>Item</tt></a>
  3068. &mdash;&nbsp;the item above which it should be inserted
  3069. </li>
  3070. </ul>
  3071. <ul class="member-list">
  3072. <h4>Returns:</h4>
  3073. <li>
  3074. <tt><a href="../classes/Item.html"><tt>Item</tt></a></tt>&nbsp;&mdash;&nbsp;the inserted item, or <code>null</code> if inserting was not possible
  3075. </li>
  3076. </ul>
  3077. </div>
  3078. </div>
  3079. </div>
  3080. <div id="insertbelow-item" class="member">
  3081. <div class="member-link">
  3082. <a name="insertbelow-item" href="#insertbelow-item"><tt><b>insertBelow</b>(item)</tt></a>
  3083. </div>
  3084. <div class="member-description hidden">
  3085. <div class="member-text">
  3086. <p>Inserts this item below the specified item.</p>
  3087. <ul class="member-list">
  3088. <h4>Parameters:</h4>
  3089. <li>
  3090. <tt>item:</tt>
  3091. <a href="../classes/Item.html"><tt>Item</tt></a>
  3092. &mdash;&nbsp;the item below which it should be inserted
  3093. </li>
  3094. </ul>
  3095. <ul class="member-list">
  3096. <h4>Returns:</h4>
  3097. <li>
  3098. <tt><a href="../classes/Item.html"><tt>Item</tt></a></tt>&nbsp;&mdash;&nbsp;the inserted item, or <code>null</code> if inserting was not possible
  3099. </li>
  3100. </ul>
  3101. </div>
  3102. </div>
  3103. </div>
  3104. <div id="sendtoback" class="member">
  3105. <div class="member-link">
  3106. <a name="sendtoback" href="#sendtoback"><tt><b>sendToBack</b>()</tt></a>
  3107. </div>
  3108. <div class="member-description hidden">
  3109. <div class="member-text">
  3110. <p>Sends this item to the back of all other items within the same parent.</p>
  3111. </div>
  3112. </div>
  3113. </div>
  3114. <div id="bringtofront" class="member">
  3115. <div class="member-link">
  3116. <a name="bringtofront" href="#bringtofront"><tt><b>bringToFront</b>()</tt></a>
  3117. </div>
  3118. <div class="member-description hidden">
  3119. <div class="member-text">
  3120. <p>Brings this item to the front of all other items within the same parent.</p>
  3121. </div>
  3122. </div>
  3123. </div>
  3124. <div id="addto-owner" class="member">
  3125. <div class="member-link">
  3126. <a name="addto-owner" href="#addto-owner"><tt><b>addTo</b>(owner)</tt></a>
  3127. </div>
  3128. <div class="member-description hidden">
  3129. <div class="member-text">
  3130. <p>Adds it to the specified owner, which can be either a <a href="../classes/Item.html"><tt>Item</tt></a> or a <a href="../classes/Project.html"><tt>Project</tt></a>.</p>
  3131. <ul class="member-list">
  3132. <h4>Parameters:</h4>
  3133. <li>
  3134. <tt>owner:</tt>
  3135. <a href="../classes/Project.html"><tt>Project</tt></a>⟋<a href="../classes/Layer.html"><tt>Layer</tt></a>⟋<a href="../classes/Group.html"><tt>Group</tt></a>⟋<a href="../classes/CompoundPath.html"><tt>CompoundPath</tt></a>
  3136. &mdash;&nbsp;the item or project to add the item to
  3137. </li>
  3138. </ul>
  3139. <ul class="member-list">
  3140. <h4>Returns:</h4>
  3141. <li>
  3142. <tt><a href="../classes/Item.html"><tt>Item</tt></a></tt>&nbsp;&mdash;&nbsp;the item itself, if it was successfully added
  3143. </li>
  3144. </ul>
  3145. </div>
  3146. </div>
  3147. </div>
  3148. <div id="copyto-owner" class="member">
  3149. <div class="member-link">
  3150. <a name="copyto-owner" href="#copyto-owner"><tt><b>copyTo</b>(owner)</tt></a>
  3151. </div>
  3152. <div class="member-description hidden">
  3153. <div class="member-text">
  3154. <p>Clones the item and adds it to the specified owner, which can be either a <a href="../classes/Item.html"><tt>Item</tt></a> or a <a href="../classes/Project.html"><tt>Project</tt></a>.</p>
  3155. <ul class="member-list">
  3156. <h4>Parameters:</h4>
  3157. <li>
  3158. <tt>owner:</tt>
  3159. <a href="../classes/Project.html"><tt>Project</tt></a>⟋<a href="../classes/Layer.html"><tt>Layer</tt></a>⟋<a href="../classes/Group.html"><tt>Group</tt></a>⟋<a href="../classes/CompoundPath.html"><tt>CompoundPath</tt></a>
  3160. &mdash;&nbsp;the item or project to copy the item to
  3161. </li>
  3162. </ul>
  3163. <ul class="member-list">
  3164. <h4>Returns:</h4>
  3165. <li>
  3166. <tt><a href="../classes/Item.html"><tt>Item</tt></a></tt>&nbsp;&mdash;&nbsp;the new copy of the item, if it was successfully added
  3167. </li>
  3168. </ul>
  3169. </div>
  3170. </div>
  3171. </div>
  3172. <div id="reduce-options" class="member">
  3173. <div class="member-link">
  3174. <a name="reduce-options" href="#reduce-options"><tt><b>reduce</b>(options)</tt></a>
  3175. </div>
  3176. <div class="member-description hidden">
  3177. <div class="member-text">
  3178. <p>If this is a group, layer or compound-path with only one child-item, the child-item is moved outside and the parent is erased. Otherwise, the item itself is returned unmodified.</p>
  3179. <ul class="member-list">
  3180. <h4>Parameters:</h4>
  3181. <li>
  3182. <tt>options:</tt>
  3183. </li>
  3184. </ul>
  3185. <ul class="member-list">
  3186. <h4>Returns:</h4>
  3187. <li>
  3188. <tt><a href="../classes/Item.html"><tt>Item</tt></a></tt>&nbsp;&mdash;&nbsp;the reduced item
  3189. </li>
  3190. </ul>
  3191. </div>
  3192. </div>
  3193. </div>
  3194. <div id="remove" class="member">
  3195. <div class="member-link">
  3196. <a name="remove" href="#remove"><tt><b>remove</b>()</tt></a>
  3197. </div>
  3198. <div class="member-description hidden">
  3199. <div class="member-text">
  3200. <p>Removes the item and all its children from the project. The item is not destroyed and can be inserted again after removal.</p>
  3201. <ul class="member-list">
  3202. <h4>Returns:</h4>
  3203. <li>
  3204. <tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;<tt>true</tt> if the item was removed, <tt>false</tt> otherwise
  3205. </li>
  3206. </ul>
  3207. </div>
  3208. </div>
  3209. </div>
  3210. <div id="replacewith-item" class="member">
  3211. <div class="member-link">
  3212. <a name="replacewith-item" href="#replacewith-item"><tt><b>replaceWith</b>(item)</tt></a>
  3213. </div>
  3214. <div class="member-description hidden">
  3215. <div class="member-text">
  3216. <p>Replaces this item with the provided new item which will takes its place in the project hierarchy instead.</p>
  3217. <ul class="member-list">
  3218. <h4>Parameters:</h4>
  3219. <li>
  3220. <tt>item:</tt>
  3221. <a href="../classes/Item.html"><tt>Item</tt></a>
  3222. &mdash;&nbsp;the item that will replace this item
  3223. </li>
  3224. </ul>
  3225. <ul class="member-list">
  3226. <h4>Returns:</h4>
  3227. <li>
  3228. <tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;<tt>true</tt> if the item was replaced, <tt>false</tt> otherwise
  3229. </li>
  3230. </ul>
  3231. </div>
  3232. </div>
  3233. </div>
  3234. <div id="removechildren" class="member">
  3235. <div class="member-link">
  3236. <a name="removechildren" href="#removechildren"><tt><b>removeChildren</b>()</tt></a>
  3237. </div>
  3238. <div class="member-description hidden">
  3239. <div class="member-text">
  3240. <p>Removes all of the item&rsquo;s <a href="../classes/Item.html#children"><tt>children</tt></a> (if any).</p>
  3241. <ul class="member-list">
  3242. <h4>Returns:</h4>
  3243. <li>
  3244. <tt>Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects</tt>&nbsp;&mdash;&nbsp;an array containing the removed items
  3245. </li>
  3246. </ul>
  3247. </div>
  3248. </div>
  3249. </div>
  3250. <div id="removechildren-start" class="member">
  3251. <div class="member-link">
  3252. <a name="removechildren-start" href="#removechildren-start"><tt><b>removeChildren</b>(start[, end])</tt></a>
  3253. </div>
  3254. <div class="member-description hidden">
  3255. <div class="member-text">
  3256. <p>Removes the children from the specified <code>start</code> index to and excluding the <code>end</code> index from the parent&rsquo;s <a href="../classes/Item.html#children"><tt>children</tt></a> array.</p>
  3257. <ul class="member-list">
  3258. <h4>Parameters:</h4>
  3259. <li>
  3260. <tt>start:</tt>
  3261. <tt>Number</tt>
  3262. &mdash;&nbsp;the beginning index, inclusive
  3263. </li>
  3264. <li>
  3265. <tt>end:</tt>
  3266. <tt>Number</tt>
  3267. &mdash;&nbsp;the ending index, exclusive
  3268. &mdash;&nbsp;optional, default: <tt>children.length</tt>
  3269. </li>
  3270. </ul>
  3271. <ul class="member-list">
  3272. <h4>Returns:</h4>
  3273. <li>
  3274. <tt>Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects</tt>&nbsp;&mdash;&nbsp;an array containing the removed items
  3275. </li>
  3276. </ul>
  3277. </div>
  3278. </div>
  3279. </div>
  3280. <div id="reversechildren" class="member">
  3281. <div class="member-link">
  3282. <a name="reversechildren" href="#reversechildren"><tt><b>reverseChildren</b>()</tt></a>
  3283. </div>
  3284. <div class="member-description hidden">
  3285. <div class="member-text">
  3286. <p>Reverses the order of the item&rsquo;s children</p>
  3287. </div>
  3288. </div>
  3289. </div>
  3290. <h3>Tests</h3>
  3291. <div id="isempty" class="member">
  3292. <div class="member-link">
  3293. <a name="isempty" href="#isempty"><tt><b>isEmpty</b>([recursively])</tt></a>
  3294. </div>
  3295. <div class="member-description hidden">
  3296. <div class="member-text">
  3297. <p>Specifies whether the item has any content or not. The meaning of what content is differs from type to type. For example, a <a href="../classes/Group.html"><tt>Group</tt></a> with no children, a <a href="../classes/TextItem.html"><tt>TextItem</tt></a> with no text content and a <a href="../classes/Path.html"><tt>Path</tt></a> with no segments all are considered empty.</p>
  3298. <ul class="member-list">
  3299. <h4>Parameters:</h4>
  3300. <li>
  3301. <tt>recursively:</tt>
  3302. <tt>Boolean</tt>
  3303. &mdash;&nbsp;whether an item with children should be considered empty if all its descendants are empty
  3304. &mdash;&nbsp;optional, default: <tt>false</tt>
  3305. </li>
  3306. </ul>
  3307. <ul class="member-list">
  3308. <h4>Returns:</h4>
  3309. <li>
  3310. <tt><tt>Boolean</tt></tt>
  3311. </li>
  3312. </ul>
  3313. </div>
  3314. </div>
  3315. </div>
  3316. <h3>Style Tests</h3>
  3317. <div id="hasfill" class="member">
  3318. <div class="member-link">
  3319. <a name="hasfill" href="#hasfill"><tt><b>hasFill</b>()</tt></a>
  3320. </div>
  3321. <div class="member-description hidden">
  3322. <div class="member-text">
  3323. <p>Checks whether the item has a fill.</p>
  3324. <ul class="member-list">
  3325. <h4>Returns:</h4>
  3326. <li>
  3327. <tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;<tt>true</tt> if the item has a fill, <tt>false</tt> otherwise
  3328. </li>
  3329. </ul>
  3330. </div>
  3331. </div>
  3332. </div>
  3333. <div id="hasstroke" class="member">
  3334. <div class="member-link">
  3335. <a name="hasstroke" href="#hasstroke"><tt><b>hasStroke</b>()</tt></a>
  3336. </div>
  3337. <div class="member-description hidden">
  3338. <div class="member-text">
  3339. <p>Checks whether the item has a stroke.</p>
  3340. <ul class="member-list">
  3341. <h4>Returns:</h4>
  3342. <li>
  3343. <tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;<tt>true</tt> if the item has a stroke, <tt>false</tt> otherwise
  3344. </li>
  3345. </ul>
  3346. </div>
  3347. </div>
  3348. </div>
  3349. <div id="hasshadow" class="member">
  3350. <div class="member-link">
  3351. <a name="hasshadow" href="#hasshadow"><tt><b>hasShadow</b>()</tt></a>
  3352. </div>
  3353. <div class="member-description hidden">
  3354. <div class="member-text">
  3355. <p>Checks whether the item has a shadow.</p>
  3356. <ul class="member-list">
  3357. <h4>Returns:</h4>
  3358. <li>
  3359. <tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;<tt>true</tt> if the item has a shadow, <tt>false</tt> otherwise
  3360. </li>
  3361. </ul>
  3362. </div>
  3363. </div>
  3364. </div>
  3365. <h3>Hierarchy Tests</h3>
  3366. <div id="haschildren" class="member">
  3367. <div class="member-link">
  3368. <a name="haschildren" href="#haschildren"><tt><b>hasChildren</b>()</tt></a>
  3369. </div>
  3370. <div class="member-description hidden">
  3371. <div class="member-text">
  3372. <p>Checks if the item contains any children items.</p>
  3373. <ul class="member-list">
  3374. <h4>Returns:</h4>
  3375. <li>
  3376. <tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;<tt>true</tt> it has one or more children, <tt>false</tt> otherwise
  3377. </li>
  3378. </ul>
  3379. </div>
  3380. </div>
  3381. </div>
  3382. <div id="isinserted" class="member">
  3383. <div class="member-link">
  3384. <a name="isinserted" href="#isinserted"><tt><b>isInserted</b>()</tt></a>
  3385. </div>
  3386. <div class="member-description hidden">
  3387. <div class="member-text">
  3388. <p>Checks whether the item and all its parents are inserted into scene graph or not.</p>
  3389. <ul class="member-list">
  3390. <h4>Returns:</h4>
  3391. <li>
  3392. <tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;<tt>true</tt> if the item is inserted into the scene graph, <tt>false</tt> otherwise
  3393. </li>
  3394. </ul>
  3395. </div>
  3396. </div>
  3397. </div>
  3398. <div id="isabove-item" class="member">
  3399. <div class="member-link">
  3400. <a name="isabove-item" href="#isabove-item"><tt><b>isAbove</b>(item)</tt></a>
  3401. </div>
  3402. <div class="member-description hidden">
  3403. <div class="member-text">
  3404. <p>Checks if this item is above the specified item in the stacking order of the project.</p>
  3405. <ul class="member-list">
  3406. <h4>Parameters:</h4>
  3407. <li>
  3408. <tt>item:</tt>
  3409. <a href="../classes/Item.html"><tt>Item</tt></a>
  3410. &mdash;&nbsp;the item to check against
  3411. </li>
  3412. </ul>
  3413. <ul class="member-list">
  3414. <h4>Returns:</h4>
  3415. <li>
  3416. <tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;<tt>true</tt> if it is above the specified item, <tt>false</tt> otherwise
  3417. </li>
  3418. </ul>
  3419. </div>
  3420. </div>
  3421. </div>
  3422. <div id="isbelow-item" class="member">
  3423. <div class="member-link">
  3424. <a name="isbelow-item" href="#isbelow-item"><tt><b>isBelow</b>(item)</tt></a>
  3425. </div>
  3426. <div class="member-description hidden">
  3427. <div class="member-text">
  3428. <p>Checks if the item is below the specified item in the stacking order of the project.</p>
  3429. <ul class="member-list">
  3430. <h4>Parameters:</h4>
  3431. <li>
  3432. <tt>item:</tt>
  3433. <a href="../classes/Item.html"><tt>Item</tt></a>
  3434. &mdash;&nbsp;the item to check against
  3435. </li>
  3436. </ul>
  3437. <ul class="member-list">
  3438. <h4>Returns:</h4>
  3439. <li>
  3440. <tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;<tt>true</tt> if it is below the specified item, <tt>false</tt> otherwise
  3441. </li>
  3442. </ul>
  3443. </div>
  3444. </div>
  3445. </div>
  3446. <div id="isparent-item" class="member">
  3447. <div class="member-link">
  3448. <a name="isparent-item" href="#isparent-item"><tt><b>isParent</b>(item)</tt></a>
  3449. </div>
  3450. <div class="member-description hidden">
  3451. <div class="member-text">
  3452. <p>Checks whether the specified item is the parent of the item.</p>
  3453. <ul class="member-list">
  3454. <h4>Parameters:</h4>
  3455. <li>
  3456. <tt>item:</tt>
  3457. <a href="../classes/Item.html"><tt>Item</tt></a>
  3458. &mdash;&nbsp;the item to check against
  3459. </li>
  3460. </ul>
  3461. <ul class="member-list">
  3462. <h4>Returns:</h4>
  3463. <li>
  3464. <tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;<tt>true</tt> if it is the parent of the item, <tt>false</tt> otherwise
  3465. </li>
  3466. </ul>
  3467. </div>
  3468. </div>
  3469. </div>
  3470. <div id="ischild-item" class="member">
  3471. <div class="member-link">
  3472. <a name="ischild-item" href="#ischild-item"><tt><b>isChild</b>(item)</tt></a>
  3473. </div>
  3474. <div class="member-description hidden">
  3475. <div class="member-text">
  3476. <p>Checks whether the specified item is a child of the item.</p>
  3477. <ul class="member-list">
  3478. <h4>Parameters:</h4>
  3479. <li>
  3480. <tt>item:</tt>
  3481. <a href="../classes/Item.html"><tt>Item</tt></a>
  3482. &mdash;&nbsp;the item to check against
  3483. </li>
  3484. </ul>
  3485. <ul class="member-list">
  3486. <h4>Returns:</h4>
  3487. <li>
  3488. <tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;<tt>true</tt> it is a child of the item, <tt>false</tt> otherwise
  3489. </li>
  3490. </ul>
  3491. </div>
  3492. </div>
  3493. </div>
  3494. <div id="isdescendant-item" class="member">
  3495. <div class="member-link">
  3496. <a name="isdescendant-item" href="#isdescendant-item"><tt><b>isDescendant</b>(item)</tt></a>
  3497. </div>
  3498. <div class="member-description hidden">
  3499. <div class="member-text">
  3500. <p>Checks if the item is contained within the specified item.</p>
  3501. <ul class="member-list">
  3502. <h4>Parameters:</h4>
  3503. <li>
  3504. <tt>item:</tt>
  3505. <a href="../classes/Item.html"><tt>Item</tt></a>
  3506. &mdash;&nbsp;the item to check against
  3507. </li>
  3508. </ul>
  3509. <ul class="member-list">
  3510. <h4>Returns:</h4>
  3511. <li>
  3512. <tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;<tt>true</tt> if it is inside the specified item, <tt>false</tt> otherwise
  3513. </li>
  3514. </ul>
  3515. </div>
  3516. </div>
  3517. </div>
  3518. <div id="isancestor-item" class="member">
  3519. <div class="member-link">
  3520. <a name="isancestor-item" href="#isancestor-item"><tt><b>isAncestor</b>(item)</tt></a>
  3521. </div>
  3522. <div class="member-description hidden">
  3523. <div class="member-text">
  3524. <p>Checks if the item is an ancestor of the specified item.</p>
  3525. <ul class="member-list">
  3526. <h4>Parameters:</h4>
  3527. <li>
  3528. <tt>item:</tt>
  3529. <a href="../classes/Item.html"><tt>Item</tt></a>
  3530. &mdash;&nbsp;the item to check against
  3531. </li>
  3532. </ul>
  3533. <ul class="member-list">
  3534. <h4>Returns:</h4>
  3535. <li>
  3536. <tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;<tt>true</tt> if the item is an ancestor of the specified item, <tt>false</tt> otherwise
  3537. </li>
  3538. </ul>
  3539. </div>
  3540. </div>
  3541. </div>
  3542. <div id="issibling-item" class="member">
  3543. <div class="member-link">
  3544. <a name="issibling-item" href="#issibling-item"><tt><b>isSibling</b>(item)</tt></a>
  3545. </div>
  3546. <div class="member-description hidden">
  3547. <div class="member-text">
  3548. <p>Checks if the item is an a sibling of the specified item.</p>
  3549. <ul class="member-list">
  3550. <h4>Parameters:</h4>
  3551. <li>
  3552. <tt>item:</tt>
  3553. <a href="../classes/Item.html"><tt>Item</tt></a>
  3554. &mdash;&nbsp;the item to check against
  3555. </li>
  3556. </ul>
  3557. <ul class="member-list">
  3558. <h4>Returns:</h4>
  3559. <li>
  3560. <tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;<tt>true</tt> if the item is aa sibling of the specified item, <tt>false</tt> otherwise
  3561. </li>
  3562. </ul>
  3563. </div>
  3564. </div>
  3565. </div>
  3566. <div id="isgroupedwith-item" class="member">
  3567. <div class="member-link">
  3568. <a name="isgroupedwith-item" href="#isgroupedwith-item"><tt><b>isGroupedWith</b>(item)</tt></a>
  3569. </div>
  3570. <div class="member-description hidden">
  3571. <div class="member-text">
  3572. <p>Checks whether the item is grouped with the specified item.</p>
  3573. <ul class="member-list">
  3574. <h4>Parameters:</h4>
  3575. <li>
  3576. <tt>item:</tt>
  3577. <a href="../classes/Item.html"><tt>Item</tt></a>
  3578. </li>
  3579. </ul>
  3580. <ul class="member-list">
  3581. <h4>Returns:</h4>
  3582. <li>
  3583. <tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;<tt>true</tt> if the items are grouped together, <tt>false</tt> otherwise
  3584. </li>
  3585. </ul>
  3586. </div>
  3587. </div>
  3588. </div>
  3589. <h3>Transform Functions</h3>
  3590. <div id="translate-delta" class="member">
  3591. <div class="member-link">
  3592. <a name="translate-delta" href="#translate-delta"><tt><b>translate</b>(delta)</tt></a>
  3593. </div>
  3594. <div class="member-description hidden">
  3595. <div class="member-text">
  3596. <p>Translates (moves) the item by the given offset views.</p>
  3597. <ul class="member-list">
  3598. <h4>Parameters:</h4>
  3599. <li>
  3600. <tt>delta:</tt>
  3601. <a href="../classes/Point.html"><tt>Point</tt></a>
  3602. &mdash;&nbsp;the offset to translate the item by
  3603. </li>
  3604. </ul>
  3605. </div>
  3606. </div>
  3607. </div>
  3608. <div id="rotate-angle" class="member">
  3609. <div class="member-link">
  3610. <a name="rotate-angle" href="#rotate-angle"><tt><b>rotate</b>(angle[, center])</tt></a>
  3611. </div>
  3612. <div class="member-description hidden">
  3613. <div class="member-text">
  3614. <p>Rotates the item by a given angle around the given center point.</p>
  3615. <p>Angles are oriented clockwise and measured in degrees.</p>
  3616. <ul class="member-list">
  3617. <h4>Parameters:</h4>
  3618. <li>
  3619. <tt>angle:</tt>
  3620. <tt>Number</tt>
  3621. &mdash;&nbsp;the rotation angle
  3622. </li>
  3623. <li>
  3624. <tt>center:</tt>
  3625. <a href="../classes/Point.html"><tt>Point</tt></a>
  3626. &mdash;&nbsp;optional, default: <tt><a href="../classes/Item.html#position"><tt>item.position</tt></a></tt>
  3627. </li>
  3628. </ul>
  3629. <ul class="member-list">
  3630. <h4>See also:</h4>
  3631. <li><tt><a href="../classes/Matrix.html#rotate-angle"><tt>matrix.rotate(angle[, center])</tt></a></tt></li>
  3632. </ul>
  3633. <h4>Example:<span class="description">Rotating an item:</span></h4>
  3634. <div class="paperscript split">
  3635. <div class="buttons">
  3636. <div class="button run">Run</div>
  3637. </div>
  3638. <script type="text/paperscript" canvas="canvas-51">
  3639. // Create a rectangle shaped path with its top left
  3640. // point at {x: 80, y: 25} and a size of {width: 50, height: 50}:
  3641. var path = new Path.Rectangle(new Point(80, 25), new Size(50, 50));
  3642. path.fillColor = 'black';
  3643. // Rotate the path by 30 degrees:
  3644. path.rotate(30);
  3645. </script>
  3646. <div class="canvas"><canvas width="516" height="100" id="canvas-51"></canvas></div>
  3647. </div>
  3648. <h4>Example:<span class="description">Rotating an item around a specific point:</span></h4>
  3649. <div class="paperscript split">
  3650. <div class="buttons">
  3651. <div class="button run">Run</div>
  3652. </div>
  3653. <script type="text/paperscript" canvas="canvas-52">
  3654. // Create a rectangle shaped path with its top left
  3655. // point at {x: 175, y: 50} and a size of {width: 100, height: 100}:
  3656. var topLeft = new Point(175, 50);
  3657. var size = new Size(100, 100);
  3658. var path = new Path.Rectangle(topLeft, size);
  3659. path.fillColor = 'black';
  3660. // Draw a circle shaped path in the center of the view,
  3661. // to show the rotation point:
  3662. var circle = new Path.Circle({
  3663. center: view.center,
  3664. radius: 5,
  3665. fillColor: 'white'
  3666. });
  3667. // Each frame rotate the path 3 degrees around the center point
  3668. // of the view:
  3669. function onFrame(event) {
  3670. path.rotate(3, view.center);
  3671. }
  3672. </script>
  3673. <div class="canvas"><canvas width="516" height="200" id="canvas-52"></canvas></div>
  3674. </div>
  3675. </div>
  3676. </div>
  3677. </div>
  3678. <div id="scale-scale" class="member">
  3679. <div class="member-link">
  3680. <a name="scale-scale" href="#scale-scale"><tt><b>scale</b>(scale[, center])</tt></a>
  3681. </div>
  3682. <div class="member-description hidden">
  3683. <div class="member-text">
  3684. <p>Scales the item by the given value from its center point, or optionally from a supplied point.</p>
  3685. <ul class="member-list">
  3686. <h4>Parameters:</h4>
  3687. <li>
  3688. <tt>scale:</tt>
  3689. <tt>Number</tt>
  3690. &mdash;&nbsp;the scale factor
  3691. </li>
  3692. <li>
  3693. <tt>center:</tt>
  3694. <a href="../classes/Point.html"><tt>Point</tt></a>
  3695. &mdash;&nbsp;optional, default: <tt><a href="../classes/Item.html#position"><tt>item.position</tt></a></tt>
  3696. </li>
  3697. </ul>
  3698. <h4>Example:<span class="description">Scaling an item from its center point:</span></h4>
  3699. <div class="paperscript split">
  3700. <div class="buttons">
  3701. <div class="button run">Run</div>
  3702. </div>
  3703. <script type="text/paperscript" canvas="canvas-53">
  3704. // Create a circle shaped path at { x: 80, y: 50 }
  3705. // with a radius of 20:
  3706. var circle = new Path.Circle({
  3707. center: [80, 50],
  3708. radius: 20,
  3709. fillColor: 'red'
  3710. });
  3711. // Scale the path by 150% from its center point
  3712. circle.scale(1.5);
  3713. </script>
  3714. <div class="canvas"><canvas width="516" height="100" id="canvas-53"></canvas></div>
  3715. </div>
  3716. <h4>Example:<span class="description">Scaling an item from a specific point:</span></h4>
  3717. <div class="paperscript split">
  3718. <div class="buttons">
  3719. <div class="button run">Run</div>
  3720. </div>
  3721. <script type="text/paperscript" canvas="canvas-54">
  3722. // Create a circle shaped path at { x: 80, y: 50 }
  3723. // with a radius of 20:
  3724. var circle = new Path.Circle({
  3725. center: [80, 50],
  3726. radius: 20,
  3727. fillColor: 'red'
  3728. });
  3729. // Scale the path 150% from its bottom left corner
  3730. circle.scale(1.5, circle.bounds.bottomLeft);
  3731. </script>
  3732. <div class="canvas"><canvas width="516" height="100" id="canvas-54"></canvas></div>
  3733. </div>
  3734. </div>
  3735. </div>
  3736. </div>
  3737. <div id="scale-hor-ver" class="member">
  3738. <div class="member-link">
  3739. <a name="scale-hor-ver" href="#scale-hor-ver"><tt><b>scale</b>(hor, ver[, center])</tt></a>
  3740. </div>
  3741. <div class="member-description hidden">
  3742. <div class="member-text">
  3743. <p>Scales the item by the given values from its center point, or optionally from a supplied point.</p>
  3744. <ul class="member-list">
  3745. <h4>Parameters:</h4>
  3746. <li>
  3747. <tt>hor:</tt>
  3748. <tt>Number</tt>
  3749. &mdash;&nbsp;the horizontal scale factor
  3750. </li>
  3751. <li>
  3752. <tt>ver:</tt>
  3753. <tt>Number</tt>
  3754. &mdash;&nbsp;the vertical scale factor
  3755. </li>
  3756. <li>
  3757. <tt>center:</tt>
  3758. <a href="../classes/Point.html"><tt>Point</tt></a>
  3759. &mdash;&nbsp;optional, default: <tt><a href="../classes/Item.html#position"><tt>item.position</tt></a></tt>
  3760. </li>
  3761. </ul>
  3762. <h4>Example:<span class="description">Scaling an item horizontally by 300%:</span></h4>
  3763. <div class="paperscript split">
  3764. <div class="buttons">
  3765. <div class="button run">Run</div>
  3766. </div>
  3767. <script type="text/paperscript" canvas="canvas-55">
  3768. // Create a circle shaped path at { x: 100, y: 50 }
  3769. // with a radius of 20:
  3770. var circle = new Path.Circle({
  3771. center: [100, 50],
  3772. radius: 20,
  3773. fillColor: 'red'
  3774. });
  3775. // Scale the path horizontally by 300%
  3776. circle.scale(3, 1);
  3777. </script>
  3778. <div class="canvas"><canvas width="516" height="100" id="canvas-55"></canvas></div>
  3779. </div>
  3780. </div>
  3781. </div>
  3782. </div>
  3783. <div id="shear-shear" class="member">
  3784. <div class="member-link">
  3785. <a name="shear-shear" href="#shear-shear"><tt><b>shear</b>(shear[, center])</tt></a>
  3786. </div>
  3787. <div class="member-description hidden">
  3788. <div class="member-text">
  3789. <p>Shears the item by the given value from its center point, or optionally by a supplied point.</p>
  3790. <ul class="member-list">
  3791. <h4>Parameters:</h4>
  3792. <li>
  3793. <tt>shear:</tt>
  3794. <a href="../classes/Point.html"><tt>Point</tt></a>
  3795. &mdash;&nbsp;the horizontal and vertical shear factors as a point
  3796. </li>
  3797. <li>
  3798. <tt>center:</tt>
  3799. <a href="../classes/Point.html"><tt>Point</tt></a>
  3800. &mdash;&nbsp;optional, default: <tt><a href="../classes/Item.html#position"><tt>item.position</tt></a></tt>
  3801. </li>
  3802. </ul>
  3803. <ul class="member-list">
  3804. <h4>See also:</h4>
  3805. <li><tt><a href="../classes/Matrix.html#shear-shear"><tt>matrix.shear(shear[, center])</tt></a></tt></li>
  3806. </ul>
  3807. </div>
  3808. </div>
  3809. </div>
  3810. <div id="shear-hor-ver" class="member">
  3811. <div class="member-link">
  3812. <a name="shear-hor-ver" href="#shear-hor-ver"><tt><b>shear</b>(hor, ver[, center])</tt></a>
  3813. </div>
  3814. <div class="member-description hidden">
  3815. <div class="member-text">
  3816. <p>Shears the item by the given values from its center point, or optionally by a supplied point.</p>
  3817. <ul class="member-list">
  3818. <h4>Parameters:</h4>
  3819. <li>
  3820. <tt>hor:</tt>
  3821. <tt>Number</tt>
  3822. &mdash;&nbsp;the horizontal shear factor
  3823. </li>
  3824. <li>
  3825. <tt>ver:</tt>
  3826. <tt>Number</tt>
  3827. &mdash;&nbsp;the vertical shear factor
  3828. </li>
  3829. <li>
  3830. <tt>center:</tt>
  3831. <a href="../classes/Point.html"><tt>Point</tt></a>
  3832. &mdash;&nbsp;optional, default: <tt><a href="../classes/Item.html#position"><tt>item.position</tt></a></tt>
  3833. </li>
  3834. </ul>
  3835. <ul class="member-list">
  3836. <h4>See also:</h4>
  3837. <li><tt><a href="../classes/Matrix.html#shear-hor-ver"><tt>matrix.shear(hor, ver[, center])</tt></a></tt></li>
  3838. </ul>
  3839. </div>
  3840. </div>
  3841. </div>
  3842. <div id="skew-skew" class="member">
  3843. <div class="member-link">
  3844. <a name="skew-skew" href="#skew-skew"><tt><b>skew</b>(skew[, center])</tt></a>
  3845. </div>
  3846. <div class="member-description hidden">
  3847. <div class="member-text">
  3848. <p>Skews the item by the given angles from its center point, or optionally by a supplied point.</p>
  3849. <ul class="member-list">
  3850. <h4>Parameters:</h4>
  3851. <li>
  3852. <tt>skew:</tt>
  3853. <a href="../classes/Point.html"><tt>Point</tt></a>
  3854. &mdash;&nbsp;the horizontal and vertical skew angles in degrees
  3855. </li>
  3856. <li>
  3857. <tt>center:</tt>
  3858. <a href="../classes/Point.html"><tt>Point</tt></a>
  3859. &mdash;&nbsp;optional, default: <tt><a href="../classes/Item.html#position"><tt>item.position</tt></a></tt>
  3860. </li>
  3861. </ul>
  3862. <ul class="member-list">
  3863. <h4>See also:</h4>
  3864. <li><tt><a href="../classes/Matrix.html#shear-skew"><tt>matrix.shear(skew[, center])</tt></a></tt></li>
  3865. </ul>
  3866. </div>
  3867. </div>
  3868. </div>
  3869. <div id="skew-hor-ver" class="member">
  3870. <div class="member-link">
  3871. <a name="skew-hor-ver" href="#skew-hor-ver"><tt><b>skew</b>(hor, ver[, center])</tt></a>
  3872. </div>
  3873. <div class="member-description hidden">
  3874. <div class="member-text">
  3875. <p>Skews the item by the given angles from its center point, or optionally by a supplied point.</p>
  3876. <ul class="member-list">
  3877. <h4>Parameters:</h4>
  3878. <li>
  3879. <tt>hor:</tt>
  3880. <tt>Number</tt>
  3881. &mdash;&nbsp;the horizontal skew angle in degrees
  3882. </li>
  3883. <li>
  3884. <tt>ver:</tt>
  3885. <tt>Number</tt>
  3886. &mdash;&nbsp;the vertical sskew angle in degrees
  3887. </li>
  3888. <li>
  3889. <tt>center:</tt>
  3890. <a href="../classes/Point.html"><tt>Point</tt></a>
  3891. &mdash;&nbsp;optional, default: <tt><a href="../classes/Item.html#position"><tt>item.position</tt></a></tt>
  3892. </li>
  3893. </ul>
  3894. <ul class="member-list">
  3895. <h4>See also:</h4>
  3896. <li><tt><a href="../classes/Matrix.html#shear-hor-ver"><tt>matrix.shear(hor, ver[, center])</tt></a></tt></li>
  3897. </ul>
  3898. </div>
  3899. </div>
  3900. </div>
  3901. <div id="transform-matrix" class="member">
  3902. <div class="member-link">
  3903. <a name="transform-matrix" href="#transform-matrix"><tt><b>transform</b>(matrix)</tt></a>
  3904. </div>
  3905. <div class="member-description hidden">
  3906. <div class="member-text">
  3907. <p>Transform the item.</p>
  3908. <ul class="member-list">
  3909. <h4>Parameters:</h4>
  3910. <li>
  3911. <tt>matrix:</tt>
  3912. <a href="../classes/Matrix.html"><tt>Matrix</tt></a>
  3913. &mdash;&nbsp;the matrix by which the item shall be transformed
  3914. </li>
  3915. </ul>
  3916. </div>
  3917. </div>
  3918. </div>
  3919. <div id="globaltolocal-point" class="member">
  3920. <div class="member-link">
  3921. <a name="globaltolocal-point" href="#globaltolocal-point"><tt><b>globalToLocal</b>(point)</tt></a>
  3922. </div>
  3923. <div class="member-description hidden">
  3924. <div class="member-text">
  3925. <p>Converts the specified point from global project coordinate space to the item&rsquo;s own local coordinate space.</p>
  3926. <ul class="member-list">
  3927. <h4>Parameters:</h4>
  3928. <li>
  3929. <tt>point:</tt>
  3930. <a href="../classes/Point.html"><tt>Point</tt></a>
  3931. &mdash;&nbsp;the point to be transformed
  3932. </li>
  3933. </ul>
  3934. <ul class="member-list">
  3935. <h4>Returns:</h4>
  3936. <li>
  3937. <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>&nbsp;&mdash;&nbsp;the transformed point as a new instance
  3938. </li>
  3939. </ul>
  3940. </div>
  3941. </div>
  3942. </div>
  3943. <div id="localtoglobal-point" class="member">
  3944. <div class="member-link">
  3945. <a name="localtoglobal-point" href="#localtoglobal-point"><tt><b>localToGlobal</b>(point)</tt></a>
  3946. </div>
  3947. <div class="member-description hidden">
  3948. <div class="member-text">
  3949. <p>Converts the specified point from the item&rsquo;s own local coordinate space to the global project coordinate space.</p>
  3950. <ul class="member-list">
  3951. <h4>Parameters:</h4>
  3952. <li>
  3953. <tt>point:</tt>
  3954. <a href="../classes/Point.html"><tt>Point</tt></a>
  3955. &mdash;&nbsp;the point to be transformed
  3956. </li>
  3957. </ul>
  3958. <ul class="member-list">
  3959. <h4>Returns:</h4>
  3960. <li>
  3961. <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>&nbsp;&mdash;&nbsp;the transformed point as a new instance
  3962. </li>
  3963. </ul>
  3964. </div>
  3965. </div>
  3966. </div>
  3967. <div id="parenttolocal-point" class="member">
  3968. <div class="member-link">
  3969. <a name="parenttolocal-point" href="#parenttolocal-point"><tt><b>parentToLocal</b>(point)</tt></a>
  3970. </div>
  3971. <div class="member-description hidden">
  3972. <div class="member-text">
  3973. <p>Converts the specified point from the parent&rsquo;s coordinate space to item&rsquo;s own local coordinate space.</p>
  3974. <ul class="member-list">
  3975. <h4>Parameters:</h4>
  3976. <li>
  3977. <tt>point:</tt>
  3978. <a href="../classes/Point.html"><tt>Point</tt></a>
  3979. &mdash;&nbsp;the point to be transformed
  3980. </li>
  3981. </ul>
  3982. <ul class="member-list">
  3983. <h4>Returns:</h4>
  3984. <li>
  3985. <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>&nbsp;&mdash;&nbsp;the transformed point as a new instance
  3986. </li>
  3987. </ul>
  3988. </div>
  3989. </div>
  3990. </div>
  3991. <div id="localtoparent-point" class="member">
  3992. <div class="member-link">
  3993. <a name="localtoparent-point" href="#localtoparent-point"><tt><b>localToParent</b>(point)</tt></a>
  3994. </div>
  3995. <div class="member-description hidden">
  3996. <div class="member-text">
  3997. <p>Converts the specified point from the item&rsquo;s own local coordinate space to the parent&rsquo;s coordinate space.</p>
  3998. <ul class="member-list">
  3999. <h4>Parameters:</h4>
  4000. <li>
  4001. <tt>point:</tt>
  4002. <a href="../classes/Point.html"><tt>Point</tt></a>
  4003. &mdash;&nbsp;the point to be transformed
  4004. </li>
  4005. </ul>
  4006. <ul class="member-list">
  4007. <h4>Returns:</h4>
  4008. <li>
  4009. <tt><a href="../classes/Point.html"><tt>Point</tt></a></tt>&nbsp;&mdash;&nbsp;the transformed point as a new instance
  4010. </li>
  4011. </ul>
  4012. </div>
  4013. </div>
  4014. </div>
  4015. <div id="fitbounds-rectangle" class="member">
  4016. <div class="member-link">
  4017. <a name="fitbounds-rectangle" href="#fitbounds-rectangle"><tt><b>fitBounds</b>(rectangle[, fill])</tt></a>
  4018. </div>
  4019. <div class="member-description hidden">
  4020. <div class="member-text">
  4021. <p>Transform the item so that its <a href="../classes/Item.html#bounds"><tt>bounds</tt></a> fit within the specified rectangle, without changing its aspect ratio.</p>
  4022. <ul class="member-list">
  4023. <h4>Parameters:</h4>
  4024. <li>
  4025. <tt>rectangle:</tt>
  4026. <a href="../classes/Rectangle.html"><tt>Rectangle</tt></a>
  4027. </li>
  4028. <li>
  4029. <tt>fill:</tt>
  4030. <tt>Boolean</tt>
  4031. &mdash;&nbsp;optional, default: <tt>false</tt>
  4032. </li>
  4033. </ul>
  4034. <h4>Example:<span class="description">Fitting an item to the bounding rectangle of another item's bounding rectangle:</span></h4>
  4035. <div class="paperscript split">
  4036. <div class="buttons">
  4037. <div class="button run">Run</div>
  4038. </div>
  4039. <script type="text/paperscript" canvas="canvas-56">
  4040. // Create a rectangle shaped path with its top left corner
  4041. // at {x: 80, y: 25} and a size of {width: 75, height: 50}:
  4042. var path = new Path.Rectangle({
  4043. point: [80, 25],
  4044. size: [75, 50],
  4045. fillColor: 'black'
  4046. });
  4047. // Create a circle shaped path with its center at {x: 80, y: 50}
  4048. // and a radius of 30.
  4049. var circlePath = new Path.Circle({
  4050. center: [80, 50],
  4051. radius: 30,
  4052. fillColor: 'red'
  4053. });
  4054. // Fit the circlePath to the bounding rectangle of
  4055. // the rectangular path:
  4056. circlePath.fitBounds(path.bounds);
  4057. </script>
  4058. <div class="canvas"><canvas width="516" height="100" id="canvas-56"></canvas></div>
  4059. </div>
  4060. <h4>Example:<span class="description">Fitting an item to the bounding rectangle of another item's bounding rectangle with the fill parameter set to true:</span></h4>
  4061. <div class="paperscript split">
  4062. <div class="buttons">
  4063. <div class="button run">Run</div>
  4064. </div>
  4065. <script type="text/paperscript" canvas="canvas-57">
  4066. // Create a rectangle shaped path with its top left corner
  4067. // at {x: 80, y: 25} and a size of {width: 75, height: 50}:
  4068. var path = new Path.Rectangle({
  4069. point: [80, 25],
  4070. size: [75, 50],
  4071. fillColor: 'black'
  4072. });
  4073. // Create a circle shaped path with its center at {x: 80, y: 50}
  4074. // and a radius of 30.
  4075. var circlePath = new Path.Circle({
  4076. center: [80, 50],
  4077. radius: 30,
  4078. fillColor: 'red'
  4079. });
  4080. // Fit the circlePath to the bounding rectangle of
  4081. // the rectangular path:
  4082. circlePath.fitBounds(path.bounds, true);
  4083. </script>
  4084. <div class="canvas"><canvas width="516" height="100" id="canvas-57"></canvas></div>
  4085. </div>
  4086. <h4>Example:<span class="description">Fitting an item to the bounding rectangle of the view</span></h4>
  4087. <div class="paperscript split">
  4088. <div class="buttons">
  4089. <div class="button run">Run</div>
  4090. </div>
  4091. <script type="text/paperscript" canvas="canvas-58">
  4092. var path = new Path.Circle({
  4093. center: [80, 50],
  4094. radius: 30,
  4095. fillColor: 'red'
  4096. });
  4097. // Fit the path to the bounding rectangle of the view:
  4098. path.fitBounds(view.bounds);
  4099. </script>
  4100. <div class="canvas"><canvas width="516" height="200" id="canvas-58"></canvas></div>
  4101. </div>
  4102. </div>
  4103. </div>
  4104. </div>
  4105. <h3>Event Handling</h3>
  4106. <div id="on-type-function" class="member">
  4107. <div class="member-link">
  4108. <a name="on-type-function" href="#on-type-function"><tt><b>on</b>(type, function)</tt></a>
  4109. </div>
  4110. <div class="member-description hidden">
  4111. <div class="member-text">
  4112. <p>Attaches an event handler to the item.</p>
  4113. <ul class="member-list">
  4114. <h4>Parameters:</h4>
  4115. <li>
  4116. <tt>type:</tt>
  4117. <tt>String</tt>
  4118. &mdash;&nbsp;the type of event: <tt>&lsquo;frame&rsquo;</tt>, <tt>mousedown&rsquo;</tt>, <tt>&lsquo;mouseup&rsquo;</tt>, <tt>&lsquo;mousedrag&rsquo;</tt>, <tt>&lsquo;click&rsquo;</tt>, <tt>&lsquo;doubleclick&rsquo;</tt>, <tt>&lsquo;mousemove&rsquo;</tt>, <tt>&lsquo;mouseenter&rsquo;</tt>, <tt>&lsquo;mouseleave&rsquo;</tt>
  4119. </li>
  4120. <li>
  4121. <tt>function:</tt>
  4122. <tt>Function</tt>
  4123. &mdash;&nbsp;the function to be called when the event occurs, receiving a <a href="../classes/MouseEvent.html"><tt>MouseEvent</tt></a> or <a href="../classes/Event.html"><tt>Event</tt></a> object as its sole argument
  4124. </li>
  4125. </ul>
  4126. <ul class="member-list">
  4127. <h4>Returns:</h4>
  4128. <li>
  4129. <tt><a href="../classes/Item.html"><tt>Item</tt></a></tt>&nbsp;&mdash;&nbsp;this item itself, so calls can be chained
  4130. </li>
  4131. </ul>
  4132. <h4>Example:<span class="description">Change the fill color of the path to red when the mouse enters its shape and back to black again, when it leaves its shape.</span></h4>
  4133. <div class="paperscript split">
  4134. <div class="buttons">
  4135. <div class="button run">Run</div>
  4136. </div>
  4137. <script type="text/paperscript" canvas="canvas-59">
  4138. // Create a circle shaped path at the center of the view:
  4139. var path = new Path.Circle({
  4140. center: view.center,
  4141. radius: 25,
  4142. fillColor: 'black'
  4143. });
  4144. // When the mouse enters the item, set its fill color to red:
  4145. path.on('mouseenter', function() {
  4146. this.fillColor = 'red';
  4147. });
  4148. // When the mouse leaves the item, set its fill color to black:
  4149. path.on('mouseleave', function() {
  4150. this.fillColor = 'black';
  4151. });
  4152. </script>
  4153. <div class="canvas"><canvas width="516" height="100" id="canvas-59"></canvas></div>
  4154. </div>
  4155. </div>
  4156. </div>
  4157. </div>
  4158. <div id="on-object" class="member">
  4159. <div class="member-link">
  4160. <a name="on-object" href="#on-object"><tt><b>on</b>(object)</tt></a>
  4161. </div>
  4162. <div class="member-description hidden">
  4163. <div class="member-text">
  4164. <p>Attaches one or more event handlers to the item.</p>
  4165. <ul class="member-list">
  4166. <h4>Parameters:</h4>
  4167. <li>
  4168. <tt>object:</tt>
  4169. <tt>Object</tt>
  4170. &mdash;&nbsp;an object containing one or more of the following properties: <tt>frame</tt>, <tt>mousedown</tt>, <tt>mouseup</tt>, <tt>mousedrag</tt>, <tt>click</tt>, <tt>doubleclick</tt>, <tt>mousemove</tt>, <tt>mouseenter</tt>, <tt>mouseleave</tt>
  4171. </li>
  4172. </ul>
  4173. <ul class="member-list">
  4174. <h4>Returns:</h4>
  4175. <li>
  4176. <tt><a href="../classes/Item.html"><tt>Item</tt></a></tt>&nbsp;&mdash;&nbsp;this item itself, so calls can be chained
  4177. </li>
  4178. </ul>
  4179. <h4>Example:<span class="description">Change the fill color of the path to red when the mouse enters its shape and back to black again, when it leaves its shape.</span></h4>
  4180. <div class="paperscript split">
  4181. <div class="buttons">
  4182. <div class="button run">Run</div>
  4183. </div>
  4184. <script type="text/paperscript" canvas="canvas-60">
  4185. // Create a circle shaped path at the center of the view:
  4186. var path = new Path.Circle({
  4187. center: view.center,
  4188. radius: 25
  4189. });
  4190. path.fillColor = 'black';
  4191. // When the mouse enters the item, set its fill color to red:
  4192. path.on({
  4193. mouseenter: function(event) {
  4194. this.fillColor = 'red';
  4195. },
  4196. mouseleave: function(event) {
  4197. this.fillColor = 'black';
  4198. }
  4199. });
  4200. </script>
  4201. <div class="canvas"><canvas width="516" height="100" id="canvas-60"></canvas></div>
  4202. </div>
  4203. <h4>Example:<span class="description">When you click the mouse, you create new circle shaped items. When you move the mouse over the item, its fill color is set to red. When you move the mouse outside again, its fill color is set black.</span></h4>
  4204. <div class="paperscript split">
  4205. <div class="buttons">
  4206. <div class="button run">Run</div>
  4207. </div>
  4208. <script type="text/paperscript" canvas="canvas-61">
  4209. var pathHandlers = {
  4210. mouseenter: function(event) {
  4211. this.fillColor = 'red';
  4212. },
  4213. mouseleave: function(event) {
  4214. this.fillColor = 'black';
  4215. }
  4216. }
  4217. // When the mouse is pressed:
  4218. function onMouseDown(event) {
  4219. // Create a circle shaped path at the position of the mouse:
  4220. var path = new Path.Circle({
  4221. center: event.point,
  4222. radius: 25,
  4223. fillColor: 'black'
  4224. });
  4225. // Attach the handers inside the object literal to the path:
  4226. path.on(pathHandlers);
  4227. }
  4228. </script>
  4229. <div class="canvas"><canvas width="516" height="100" id="canvas-61"></canvas></div>
  4230. </div>
  4231. </div>
  4232. </div>
  4233. </div>
  4234. <div id="off-type-function" class="member">
  4235. <div class="member-link">
  4236. <a name="off-type-function" href="#off-type-function"><tt><b>off</b>(type, function)</tt></a>
  4237. </div>
  4238. <div class="member-description hidden">
  4239. <div class="member-text">
  4240. <p>Detach an event handler from the item.</p>
  4241. <ul class="member-list">
  4242. <h4>Parameters:</h4>
  4243. <li>
  4244. <tt>type:</tt>
  4245. <tt>String</tt>
  4246. &mdash;&nbsp;the type of event: <tt>&lsquo;frame&rsquo;</tt>, <tt>mousedown&rsquo;</tt>, <tt>&lsquo;mouseup&rsquo;</tt>, <tt>&lsquo;mousedrag&rsquo;</tt>, <tt>&lsquo;click&rsquo;</tt>, <tt>&lsquo;doubleclick&rsquo;</tt>, <tt>&lsquo;mousemove&rsquo;</tt>, <tt>&lsquo;mouseenter&rsquo;</tt>, <tt>&lsquo;mouseleave&rsquo;</tt>
  4247. </li>
  4248. <li>
  4249. <tt>function:</tt>
  4250. <tt>Function</tt>
  4251. &mdash;&nbsp;the function to be detached
  4252. </li>
  4253. </ul>
  4254. <ul class="member-list">
  4255. <h4>Returns:</h4>
  4256. <li>
  4257. <tt><a href="../classes/Item.html"><tt>Item</tt></a></tt>&nbsp;&mdash;&nbsp;this item itself, so calls can be chained
  4258. </li>
  4259. </ul>
  4260. </div>
  4261. </div>
  4262. </div>
  4263. <div id="off-object" class="member">
  4264. <div class="member-link">
  4265. <a name="off-object" href="#off-object"><tt><b>off</b>(object)</tt></a>
  4266. </div>
  4267. <div class="member-description hidden">
  4268. <div class="member-text">
  4269. <p>Detach one or more event handlers to the item.</p>
  4270. <ul class="member-list">
  4271. <h4>Parameters:</h4>
  4272. <li>
  4273. <tt>object:</tt>
  4274. <tt>Object</tt>
  4275. &mdash;&nbsp;an object containing one or more of the following properties: <tt>frame</tt>, <tt>mousedown</tt>, <tt>mouseup</tt>, <tt>mousedrag</tt>, <tt>click</tt>, <tt>doubleclick</tt>, <tt>mousemove</tt>, <tt>mouseenter</tt>, <tt>mouseleave</tt>
  4276. </li>
  4277. </ul>
  4278. <ul class="member-list">
  4279. <h4>Returns:</h4>
  4280. <li>
  4281. <tt><a href="../classes/Item.html"><tt>Item</tt></a></tt>&nbsp;&mdash;&nbsp;this item itself, so calls can be chained
  4282. </li>
  4283. </ul>
  4284. </div>
  4285. </div>
  4286. </div>
  4287. <div id="emit-type-event" class="member">
  4288. <div class="member-link">
  4289. <a name="emit-type-event" href="#emit-type-event"><tt><b>emit</b>(type, event)</tt></a>
  4290. </div>
  4291. <div class="member-description hidden">
  4292. <div class="member-text">
  4293. <p>Emit an event on the item.</p>
  4294. <ul class="member-list">
  4295. <h4>Parameters:</h4>
  4296. <li>
  4297. <tt>type:</tt>
  4298. <tt>String</tt>
  4299. &mdash;&nbsp;the type of event: <tt>&lsquo;frame&rsquo;</tt>, <tt>mousedown&rsquo;</tt>, <tt>&lsquo;mouseup&rsquo;</tt>, <tt>&lsquo;mousedrag&rsquo;</tt>, <tt>&lsquo;click&rsquo;</tt>, <tt>&lsquo;doubleclick&rsquo;</tt>, <tt>&lsquo;mousemove&rsquo;</tt>, <tt>&lsquo;mouseenter&rsquo;</tt>, <tt>&lsquo;mouseleave&rsquo;</tt>
  4300. </li>
  4301. <li>
  4302. <tt>event:</tt>
  4303. <tt>Object</tt>
  4304. &mdash;&nbsp;an object literal containing properties describing the event
  4305. </li>
  4306. </ul>
  4307. <ul class="member-list">
  4308. <h4>Returns:</h4>
  4309. <li>
  4310. <tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;<tt>true</tt> if the event had listeners, <tt>false</tt> otherwise
  4311. </li>
  4312. </ul>
  4313. </div>
  4314. </div>
  4315. </div>
  4316. <div id="responds-type" class="member">
  4317. <div class="member-link">
  4318. <a name="responds-type" href="#responds-type"><tt><b>responds</b>(type)</tt></a>
  4319. </div>
  4320. <div class="member-description hidden">
  4321. <div class="member-text">
  4322. <p>Check if the item has one or more event handlers of the specified type.</p>
  4323. <ul class="member-list">
  4324. <h4>Parameters:</h4>
  4325. <li>
  4326. <tt>type:</tt>
  4327. <tt>String</tt>
  4328. &mdash;&nbsp;the type of event: <tt>&lsquo;frame&rsquo;</tt>, <tt>mousedown&rsquo;</tt>, <tt>&lsquo;mouseup&rsquo;</tt>, <tt>&lsquo;mousedrag&rsquo;</tt>, <tt>&lsquo;click&rsquo;</tt>, <tt>&lsquo;doubleclick&rsquo;</tt>, <tt>&lsquo;mousemove&rsquo;</tt>, <tt>&lsquo;mouseenter&rsquo;</tt>, <tt>&lsquo;mouseleave&rsquo;</tt>
  4329. </li>
  4330. </ul>
  4331. <ul class="member-list">
  4332. <h4>Returns:</h4>
  4333. <li>
  4334. <tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;<tt>true</tt> if the item has one or more event handlers of the specified type, <tt>false</tt> otherwise
  4335. </li>
  4336. </ul>
  4337. </div>
  4338. </div>
  4339. </div>
  4340. <h3>Remove On Event</h3>
  4341. <div id="removeon-options" class="member">
  4342. <div class="member-link">
  4343. <a name="removeon-options" href="#removeon-options"><tt><b>removeOn</b>(options)</tt></a>
  4344. </div>
  4345. <div class="member-description hidden">
  4346. <div class="member-text">
  4347. <p>Removes the item when the events specified in the passed options object occur.</p>
  4348. <ul class="member-list">
  4349. <h4>Options:</h4>
  4350. <li><tt>options.move: undefined</tt> &mdash; {Boolean) remove the item when the next <a href="../classes/Tool.html#onmousemove"><tt>tool.onMouseMove</tt></a> event is fired.</li>
  4351. <li><tt>options.drag: undefined</tt> &mdash; {Boolena) remove the item when the next <a href="../classes/Tool.html#onmousedrag"><tt>tool.onMouseDrag</tt></a> event is fired.</li>
  4352. <li><tt>options.down: undefined</tt> &mdash; {Boolean) remove the item when the next <a href="../classes/Tool.html#onmousedown"><tt>tool.onMouseDown</tt></a> event is fired.</li>
  4353. <li><tt>options.up: undefined</tt> &mdash; {Boolean) remove the item when the next <a href="../classes/Tool.html#onmouseup"><tt>tool.onMouseUp</tt></a> event is fired.</li>
  4354. </ul>
  4355. <ul class="member-list">
  4356. <h4>Parameters:</h4>
  4357. <li>
  4358. <tt>options:</tt>
  4359. <tt>Object</tt>
  4360. </li>
  4361. </ul>
  4362. <h4>Example:<span class="description">Click and drag below:</span></h4>
  4363. <div class="paperscript split">
  4364. <div class="buttons">
  4365. <div class="button run">Run</div>
  4366. </div>
  4367. <script type="text/paperscript" canvas="canvas-62">
  4368. function onMouseDrag(event) {
  4369. // Create a circle shaped path at the mouse position,
  4370. // with a radius of 10:
  4371. var path = new Path.Circle({
  4372. center: event.point,
  4373. radius: 10,
  4374. fillColor: 'black'
  4375. });
  4376. // Remove the path on the next onMouseDrag or onMouseDown event:
  4377. path.removeOn({
  4378. drag: true,
  4379. down: true
  4380. });
  4381. }
  4382. </script>
  4383. <div class="canvas"><canvas width="516" height="200" id="canvas-62"></canvas></div>
  4384. </div>
  4385. </div>
  4386. </div>
  4387. </div>
  4388. <div id="removeonmove" class="member">
  4389. <div class="member-link">
  4390. <a name="removeonmove" href="#removeonmove"><tt><b>removeOnMove</b>()</tt></a>
  4391. </div>
  4392. <div class="member-description hidden">
  4393. <div class="member-text">
  4394. <p>Removes the item when the next <a href="../classes/Tool.html#onmousemove"><tt>tool.onMouseMove</tt></a> event is fired.</p>
  4395. <h4>Example:<span class="description">Move your mouse below:</span></h4>
  4396. <div class="paperscript split">
  4397. <div class="buttons">
  4398. <div class="button run">Run</div>
  4399. </div>
  4400. <script type="text/paperscript" canvas="canvas-63">
  4401. function onMouseMove(event) {
  4402. // Create a circle shaped path at the mouse position,
  4403. // with a radius of 10:
  4404. var path = new Path.Circle({
  4405. center: event.point,
  4406. radius: 10,
  4407. fillColor: 'black'
  4408. });
  4409. // On the next move event, automatically remove the path:
  4410. path.removeOnMove();
  4411. }
  4412. </script>
  4413. <div class="canvas"><canvas width="516" height="200" id="canvas-63"></canvas></div>
  4414. </div>
  4415. </div>
  4416. </div>
  4417. </div>
  4418. <div id="removeondown" class="member">
  4419. <div class="member-link">
  4420. <a name="removeondown" href="#removeondown"><tt><b>removeOnDown</b>()</tt></a>
  4421. </div>
  4422. <div class="member-description hidden">
  4423. <div class="member-text">
  4424. <p>Removes the item when the next <a href="../classes/Tool.html#onmousedown"><tt>tool.onMouseDown</tt></a> event is fired.</p>
  4425. <h4>Example:<span class="description">Click a few times below:</span></h4>
  4426. <div class="paperscript split">
  4427. <div class="buttons">
  4428. <div class="button run">Run</div>
  4429. </div>
  4430. <script type="text/paperscript" canvas="canvas-64">
  4431. function onMouseDown(event) {
  4432. // Create a circle shaped path at the mouse position,
  4433. // with a radius of 10:
  4434. var path = new Path.Circle({
  4435. center: event.point,
  4436. radius: 10,
  4437. fillColor: 'black'
  4438. });
  4439. // Remove the path, next time the mouse is pressed:
  4440. path.removeOnDown();
  4441. }
  4442. </script>
  4443. <div class="canvas"><canvas width="516" height="200" id="canvas-64"></canvas></div>
  4444. </div>
  4445. </div>
  4446. </div>
  4447. </div>
  4448. <div id="removeondrag" class="member">
  4449. <div class="member-link">
  4450. <a name="removeondrag" href="#removeondrag"><tt><b>removeOnDrag</b>()</tt></a>
  4451. </div>
  4452. <div class="member-description hidden">
  4453. <div class="member-text">
  4454. <p>Removes the item when the next <a href="../classes/Tool.html#onmousedrag"><tt>tool.onMouseDrag</tt></a> event is fired.</p>
  4455. <h4>Example:<span class="description">Click and drag below:</span></h4>
  4456. <div class="paperscript split">
  4457. <div class="buttons">
  4458. <div class="button run">Run</div>
  4459. </div>
  4460. <script type="text/paperscript" canvas="canvas-65">
  4461. function onMouseDrag(event) {
  4462. // Create a circle shaped path at the mouse position,
  4463. // with a radius of 10:
  4464. var path = new Path.Circle({
  4465. center: event.point,
  4466. radius: 10,
  4467. fillColor: 'black'
  4468. });
  4469. // On the next drag event, automatically remove the path:
  4470. path.removeOnDrag();
  4471. }
  4472. </script>
  4473. <div class="canvas"><canvas width="516" height="200" id="canvas-65"></canvas></div>
  4474. </div>
  4475. </div>
  4476. </div>
  4477. </div>
  4478. <div id="removeonup" class="member">
  4479. <div class="member-link">
  4480. <a name="removeonup" href="#removeonup"><tt><b>removeOnUp</b>()</tt></a>
  4481. </div>
  4482. <div class="member-description hidden">
  4483. <div class="member-text">
  4484. <p>Removes the item when the next <a href="../classes/Tool.html#onmouseup"><tt>tool.onMouseUp</tt></a> event is fired.</p>
  4485. <h4>Example:<span class="description">Click a few times below:</span></h4>
  4486. <div class="paperscript split">
  4487. <div class="buttons">
  4488. <div class="button run">Run</div>
  4489. </div>
  4490. <script type="text/paperscript" canvas="canvas-66">
  4491. function onMouseDown(event) {
  4492. // Create a circle shaped path at the mouse position,
  4493. // with a radius of 10:
  4494. var path = new Path.Circle({
  4495. center: event.point,
  4496. radius: 10,
  4497. fillColor: 'black'
  4498. });
  4499. // Remove the path, when the mouse is released:
  4500. path.removeOnUp();
  4501. }
  4502. </script>
  4503. <div class="canvas"><canvas width="516" height="200" id="canvas-66"></canvas></div>
  4504. </div>
  4505. </div>
  4506. </div>
  4507. </div>
  4508. <h3>Tweening Functions</h3>
  4509. <div id="tween-from-to-options" class="member">
  4510. <div class="member-link">
  4511. <a name="tween-from-to-options" href="#tween-from-to-options"><tt><b>tween</b>(from, to, options)</tt></a>
  4512. </div>
  4513. <div class="member-description hidden">
  4514. <div class="member-text">
  4515. <p>Tween item between two states.</p>
  4516. <ul class="member-list">
  4517. <h4>Options:</h4>
  4518. <li><tt>options.duration: <tt>Number</tt></tt> &mdash; the duration of the tweening</li>
  4519. <li><tt>options.easing: <tt>Function</tt>⟋<tt>String</tt></tt> &mdash; an easing function or the type of the easing: <tt>&lsquo;linear&rsquo; &lsquo;easeInQuad&rsquo; &lsquo;easeOutQuad&rsquo; &lsquo;easeInOutQuad&rsquo; &lsquo;easeInCubic&rsquo; &lsquo;easeOutCubic&rsquo; &lsquo;easeInOutCubic&rsquo; &lsquo;easeInQuart&rsquo; &lsquo;easeOutQuart&rsquo; &lsquo;easeInOutQuart&rsquo; &lsquo;easeInQuint&rsquo; &lsquo;easeOutQuint&rsquo; &lsquo;easeInOutQuint&rsquo;</tt> &mdash;&nbsp;default: <tt>&lsquo;linear&rsquo;</tt></li>
  4520. <li><tt>options.start: <tt>Boolean</tt></tt> &mdash; whether to start tweening automatically &mdash;&nbsp;default: <tt>true</tt></li>
  4521. </ul>
  4522. <ul class="member-list">
  4523. <h4>Parameters:</h4>
  4524. <li>
  4525. <tt>from:</tt>
  4526. <tt>Object</tt>
  4527. &mdash;&nbsp;the state at the start of the tweening
  4528. </li>
  4529. <li>
  4530. <tt>to:</tt>
  4531. <tt>Object</tt>
  4532. &mdash;&nbsp;the state at the end of the tweening
  4533. </li>
  4534. <li>
  4535. <tt>options:</tt>
  4536. <tt>Object</tt>⟋<tt>Number</tt>
  4537. &mdash;&nbsp;the options or the duration
  4538. </li>
  4539. </ul>
  4540. <ul class="member-list">
  4541. <h4>Returns:</h4>
  4542. <li>
  4543. <tt><a href="../classes/Tween.html"><tt>Tween</tt></a></tt>
  4544. </li>
  4545. </ul>
  4546. <h4>Example:<span class="description">Tween fillColor:</span></h4>
  4547. <div class="paperscript split">
  4548. <div class="buttons">
  4549. <div class="button run">Run</div>
  4550. </div>
  4551. <script type="text/paperscript" canvas="canvas-67">
  4552. var path = new Path.Circle({
  4553. radius: view.bounds.height * 0.4,
  4554. center: view.center
  4555. });
  4556. path.tween(
  4557. { fillColor: 'blue' },
  4558. { fillColor: 'red' },
  4559. 3000
  4560. );
  4561. </script>
  4562. <div class="canvas"><canvas width="516" height="100" id="canvas-67"></canvas></div>
  4563. </div>
  4564. <h4>Example:<span class="description">Tween rotation:</span></h4>
  4565. <div class="paperscript split">
  4566. <div class="buttons">
  4567. <div class="button run">Run</div>
  4568. </div>
  4569. <script type="text/paperscript" canvas="canvas-68">
  4570. var path = new Shape.Rectangle({
  4571. fillColor: 'red',
  4572. center: [50, view.center.y],
  4573. size: [60, 60]
  4574. });
  4575. path.tween({
  4576. rotation: 180,
  4577. 'position.x': view.bounds.width - 50,
  4578. 'fillColor.hue': '+= 90'
  4579. }, {
  4580. easing: 'easeInOutCubic',
  4581. duration: 2000
  4582. });
  4583. </script>
  4584. <div class="canvas"><canvas width="516" height="100" id="canvas-68"></canvas></div>
  4585. </div>
  4586. </div>
  4587. </div>
  4588. </div>
  4589. <div id="tween-to-options" class="member">
  4590. <div class="member-link">
  4591. <a name="tween-to-options" href="#tween-to-options"><tt><b>tween</b>(to, options)</tt></a>
  4592. </div>
  4593. <div class="member-description hidden">
  4594. <div class="member-text">
  4595. <p>Tween item to a state.</p>
  4596. <ul class="member-list">
  4597. <h4>Parameters:</h4>
  4598. <li>
  4599. <tt>to:</tt>
  4600. <tt>Object</tt>
  4601. &mdash;&nbsp;the state at the end of the tweening
  4602. </li>
  4603. <li>
  4604. <tt>options:</tt>
  4605. <tt>Object</tt>⟋<tt>Number</tt>
  4606. &mdash;&nbsp;the options or the duration
  4607. </li>
  4608. </ul>
  4609. <ul class="member-list">
  4610. <h4>Returns:</h4>
  4611. <li>
  4612. <tt><a href="../classes/Tween.html"><tt>Tween</tt></a></tt>
  4613. </li>
  4614. </ul>
  4615. <ul class="member-list">
  4616. <h4>See also:</h4>
  4617. <li><tt><a href="../classes/Item.html#tween-from-to-options"><tt>item.tween(from, to, options)</tt></a></tt></li>
  4618. </ul>
  4619. <h4>Example:<span class="description">Tween a nested property with relative values</span></h4>
  4620. <div class="paperscript split">
  4621. <div class="buttons">
  4622. <div class="button run">Run</div>
  4623. </div>
  4624. <script type="text/paperscript" canvas="canvas-69">
  4625. var path = new Path.Rectangle({
  4626. size: [100, 100],
  4627. position: view.center,
  4628. fillColor: 'red',
  4629. });
  4630. var delta = { x: path.bounds.width / 2, y: 0 };
  4631. path.tween({
  4632. 'segments[1].point': ['+=', delta],
  4633. 'segments[2].point.x': '-= 50'
  4634. }, 3000);
  4635. </script>
  4636. <div class="canvas"><canvas width="516" height="200" id="canvas-69"></canvas></div>
  4637. </div>
  4638. </div>
  4639. </div>
  4640. </div>
  4641. <div id="tween-options" class="member">
  4642. <div class="member-link">
  4643. <a name="tween-options" href="#tween-options"><tt><b>tween</b>(options)</tt></a>
  4644. </div>
  4645. <div class="member-description hidden">
  4646. <div class="member-text">
  4647. <p>Tween item.</p>
  4648. <ul class="member-list">
  4649. <h4>Parameters:</h4>
  4650. <li>
  4651. <tt>options:</tt>
  4652. <tt>Object</tt>⟋<tt>Number</tt>
  4653. &mdash;&nbsp;the options or the duration
  4654. </li>
  4655. </ul>
  4656. <ul class="member-list">
  4657. <h4>Returns:</h4>
  4658. <li>
  4659. <tt><a href="../classes/Tween.html"><tt>Tween</tt></a></tt>
  4660. </li>
  4661. </ul>
  4662. <ul class="member-list">
  4663. <h4>See also:</h4>
  4664. <li><tt><a href="../classes/Item.html#tween-from-to-options"><tt>item.tween(from, to, options)</tt></a></tt></li>
  4665. </ul>
  4666. <h4>Example:<span class="description">Start an empty tween and just use the update callback:</span></h4>
  4667. <div class="paperscript split">
  4668. <div class="buttons">
  4669. <div class="button run">Run</div>
  4670. </div>
  4671. <script type="text/paperscript" canvas="canvas-70">
  4672. var path = new Path.Circle({
  4673. fillColor: 'blue',
  4674. radius: view.bounds.height * 0.4,
  4675. center: view.center,
  4676. });
  4677. var pathFrom = path.clone({ insert: false })
  4678. var pathTo = new Path.Rectangle({
  4679. position: view.center,
  4680. rectangle: path.bounds,
  4681. insert: false
  4682. });
  4683. path.tween(2000).onUpdate = function(event) {
  4684. path.interpolate(pathFrom, pathTo, event.factor)
  4685. };
  4686. </script>
  4687. <div class="canvas"><canvas width="516" height="100" id="canvas-70"></canvas></div>
  4688. </div>
  4689. </div>
  4690. </div>
  4691. </div>
  4692. <div id="tweento-to-options" class="member">
  4693. <div class="member-link">
  4694. <a name="tweento-to-options" href="#tweento-to-options"><tt><b>tweenTo</b>(to, options)</tt></a>
  4695. </div>
  4696. <div class="member-description hidden">
  4697. <div class="member-text">
  4698. <p>Tween item to a state.</p>
  4699. <ul class="member-list">
  4700. <h4>Parameters:</h4>
  4701. <li>
  4702. <tt>to:</tt>
  4703. <tt>Object</tt>
  4704. &mdash;&nbsp;the state at the end of the tweening
  4705. </li>
  4706. <li>
  4707. <tt>options:</tt>
  4708. <tt>Object</tt>⟋<tt>Number</tt>
  4709. &mdash;&nbsp;the options or the duration
  4710. </li>
  4711. </ul>
  4712. <ul class="member-list">
  4713. <h4>Returns:</h4>
  4714. <li>
  4715. <tt><a href="../classes/Tween.html"><tt>Tween</tt></a></tt>
  4716. </li>
  4717. </ul>
  4718. <ul class="member-list">
  4719. <h4>See also:</h4>
  4720. <li><tt><a href="../classes/Item.html#tween-to-options"><tt>item.tween(to, options)</tt></a></tt></li>
  4721. </ul>
  4722. </div>
  4723. </div>
  4724. </div>
  4725. <div id="tweenfrom-from-options" class="member">
  4726. <div class="member-link">
  4727. <a name="tweenfrom-from-options" href="#tweenfrom-from-options"><tt><b>tweenFrom</b>(from, options)</tt></a>
  4728. </div>
  4729. <div class="member-description hidden">
  4730. <div class="member-text">
  4731. <p>Tween item from a state to its state before the tweening.</p>
  4732. <ul class="member-list">
  4733. <h4>Parameters:</h4>
  4734. <li>
  4735. <tt>from:</tt>
  4736. <tt>Object</tt>
  4737. &mdash;&nbsp;the state at the start of the tweening
  4738. </li>
  4739. <li>
  4740. <tt>options:</tt>
  4741. <tt>Object</tt>⟋<tt>Number</tt>
  4742. &mdash;&nbsp;the options or the duration
  4743. </li>
  4744. </ul>
  4745. <ul class="member-list">
  4746. <h4>Returns:</h4>
  4747. <li>
  4748. <tt><a href="../classes/Tween.html"><tt>Tween</tt></a></tt>
  4749. </li>
  4750. </ul>
  4751. <ul class="member-list">
  4752. <h4>See also:</h4>
  4753. <li><tt><a href="../classes/Item.html#tween-from-to-options"><tt>item.tween(from, to, options)</tt></a></tt></li>
  4754. </ul>
  4755. <h4>Example:<span class="description">Tween fillColor from red to the path's initial fillColor:</span></h4>
  4756. <div class="paperscript split">
  4757. <div class="buttons">
  4758. <div class="button run">Run</div>
  4759. </div>
  4760. <script type="text/paperscript" canvas="canvas-71">
  4761. var path = new Path.Circle({
  4762. fillColor: 'blue',
  4763. radius: view.bounds.height * 0.4,
  4764. center: view.center
  4765. });
  4766. path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
  4767. </script>
  4768. <div class="canvas"><canvas width="516" height="100" id="canvas-71"></canvas></div>
  4769. </div>
  4770. </div>
  4771. </div>
  4772. </div>
  4773. </div>
  4774. <!-- =========================== copyright notice ========================== -->
  4775. <p class="footer">
  4776. Paper.js v0.12.15<br>
  4777. Copyright &#169; 2011—2021 <a href="http://www.lehni.org" target="_blank">J&uuml;rg Lehni</a> &amp; <a href="http://www.jonathanpuckey.com" target="_blank">Jonathan Puckey</a>. All Rights Reserved.</p>
  4778. <div class="content-end"></div>
  4779. </article>
  4780. </body>