Things you can do in Javascript/Typescript, using the CoSpaces API, which you can’t do in CoBlocks:
Physics
- Make explosions - you can both explode (push away), and implode (pull towards, using negative values): Physics | CoSpaces API
Video
- Set position of video - set track position of video in seconds.
Sound
-
Load sounds before needed - this is useful in games and animation, in order to play sounds straight away (they aren’t loaded by default, like other Items, except background sounds).
-
Change volume of Sound - you can set the volume for a sound, or use the playOneShot method to change the volume “on the fly”. Demo Example
Interaction
-
Run code when changing/exiting scenes - this is useful for continuing music across scenes, or for passing CoSpace properties, and many more use-cases.
-
Make Items Draggable - want to allow viewers to drag things around? Do it with the input.setItemDrag method
-
Disable collision for specific Items - add your Item as a parameter to the Camera.addToCollisionFilter method
Movement
-
Smooth Path looping - need silky-smooth path looping? It’s built in to the moveOnPath function.
-
Change speeds between path points - this is useful when you want an object to travel along a path at a variable speed. See the speed, startPoint, and endPoint properties in the moveOnPath options parameter.
-
Change built-in animation speed - for when you want your horse to run in slow-mo, or your dinosaur to dance faster.
-
Animate a copy of an Animated Item - it’s not possible to do this in CoBlocks (as of Feb 2021), but can be done with Scripting.
This list will be updated regularly. Feel free to suggest additions.
Note: Scripting is a PRO feature of CoSpaces Edu.