Just kept on looking at the repeat lines… and just could not help myself… [it’s lock down after all]
And I know foreach recursive madness.
//-- elements X COORDS object
var setXObjects = {
"a":["-50","-128","-192"],
"b":["-50","-128","-178"],
"c":["-64","-114","-192"],
"d":["-64","-114","-178"]
}
//-- elements Y COORDS object
var setYObjects = {
"b":["-64","-50","-64","-50"],
"c":["-128","-128","-114","-114"],
"d":["-174","-178","-192","-192"]
}
//-- coord array to loop through
var XYObjects = [setXObjects,setYObjects]
var counter = 2 // start number for id name of element.
var coord = "x" // coord we are going to set
//-- loop over each item in XYObjects
XYObjects.forEach(function(ob) {
//-- loop over this item in XYObjects
Object.keys(ob).forEach(function(key) {
//-- loop over this objects value in this XYObjects item
ob[key].forEach(function(val,index) {
//-- use the key name with object index number + counter to get the Element by ID. Set the coord to the value
hypeDocument.getElementById(key + ( index + counter) +"_hype_pat").childNodes[0].setAttribute(coord, val );
});
});
//-- change the coord and the start number
counter--
coord ="y"
});
Recently, I received a message asking if it was OK to use the templates. This was somewhat surprising to me. They're free templates. Go and have fun! HA HA. But yeah, if you're working on a commercial project, you might be looking for something more official.
So, here it is... the Photics Public License (PPL)
I thought about using the MIT license, but I don't want the templates distributed on a stand-alone basis. The PPL was created to emphasize that distinction. If people are looking for unaltered templates, then they should get them from Photics.com. I don't mind if people pass around the templates privately to their friends and co-workers. But if shared publicly, it should be done via a link to the Photics.com template page.
If you've already been using the templates in your projects, that's great! This is change is not about harassing you. If you notice, I put "Attribution Recommendation" — not "Attribution Requirement" — because I want to be friendly to people that previously used the templates.
...by comparing the width and height of a webpage, it can be quickly determined if the orientation is landscape or portrait. This technique can be applied as an alternative — or complement — to responsive elements and breakpoints.
UPDATE 7/28/2020 (Afternoon) — A new version of template was uploaded.
What I find interesting is how there are so many solutions to this problem. Here's one from @gasspenceA Flashlight (mouse follower) — back in May of 2015. It's one of the oldest templates in the "Template Gallery" category. After posting the "Spotlight" template, I looked at the forum list. I was surprised to see that one second to last. Did I waste my time? Nope, it's different, but it's another coding solution.
...and that's where the "Spotlight" template gets tricky. It uses two "On Drag" actions, so the image can be moved left/right or up/down.
That's why the "Spotlight" template uses "On Drag". While the speed is set to be a bit fast, this method has some advantages. It works well when using a trackpad or touch device. Your finger doesn't have to move so far to control the spotlight. Plus, if the spotlight exactly matched the touch location, your finger could cover the animation.
Basically, the template shows how to add real-world time-based animation. Based on the time of the day, you can load a specific scene. That same idea could be used to load a timeline, or go to a specific point in a timeline. In this example, it's a city scene that changes color... Morning, Afternoon, Evening, and Nite. There's also a corresponding greeting.
Recently, macOS added a lot of timely features... Dark Mode, Night Shift, and Dynamic Desktop. Tumult is even expanding that with their "Nightly" app...
...with a few conditionals and a timer, your Hype project can also react to the time of the day.
Instead of a game competition, something more casual was planned. That means no prizes. Instead, there's a gift for everyone that wants to make games with Hype. It's called the Photics-Physics-Bridge. By adding this JavaScript library to your project, the gap between Matter.js and Hype's Physics API is bridged. In other words, it becomes easier to make games with Hype.
That's what this week's template is all about. It shows how to make a four-way controller with Hype, by using the PPB.
If you do make a good game with Hype, starting from April 20, 2021 until October 20, 2021, can show it off in the Year of Fun
It didn't have the optional duration value, which lets the needle in the FPS gauge move more smoothly. Also, it's better coding to use innerText instead of innerHTML, when possible.
This is next video for Photics.TV, but it's not ready yet. Meanwhile, I lost track of which other templates were update. HEH! So, see Photics.com for the latest versions of the templates.
It looks like a thumbnail images is included in the Template. This doesn't seem like a good idea. The screenshot is bigger than the rest of the template. So, for these free Hype templates, I've been manually removing the thumbnail images from the updated templates.
This is a cache, so it is a disk space vs. performance issue. If thumbnails are not included then scenes need to be fully loaded and rendered when the document opens. This can potentially take a lot of time, CPU power and RAM, so we favor maintaining a cache. You're welcome to delete the thumbnails if you do not want to incur the costs of disk or transfer.
Hah, those two little characters look so innocent and they are so long as you know how to use them.
If you are not familiar with its usage and there is a small typo, it could lead to very unexpected PermanentDeletions. (even for the familiar )
Personally I would use something like this which moves them to the Trash bin.
1, find Finder items
set where to look
-set kind is other and to Hype Document Template
on run {input, parameters}
repeat with i from 1 to the number of input
set this_item to (item i of input)
set this_info to info for this_item
if name of this_info is "Thumbnails" then
tell application "Finder" to delete this_item (* moves to trash *)
end if
end repeat
end run
Just a heads up! I didn't forget about the Tumult Hype series of videos on Photics.TV. I'm planning to launch the “Captials” video on Veterans Day, since that template has a big American flag.
UPDATE: The video is scheduled to launch on 2021-11-11T13:00:00Z and here's the link…