videocontext
Advanced tools
Comparing version 0.49.0 to 0.50.1
{ | ||
"name": "videocontext", | ||
"version": "0.49.0", | ||
"version": "0.50.1", | ||
"description": "A WebGL & HTML5 graph based video composition library", | ||
@@ -5,0 +5,0 @@ "keywords":["video", "context", "composition", "timeline", "html5", "webgl"], |
@@ -75,2 +75,24 @@ //Matthew Shotton, R&D User Experience,© BBC 2015 | ||
export function generateRandomId(){ | ||
const appearanceAdjective = ["adorable", "alert", "average", "beautiful", "blonde", "bloody", "blushing", "bright", "clean", "clear", "cloudy", "colourful", "concerned","crowded", "curious", "cute", "dark", "dirty", "drab", "distinct", "dull", "elegant", "fancy", "filthy", "glamorous", "gleaming", "graceful", "grotesque", "homely", "light", "misty", "motionless", "muddy", "plain", "poised", "quaint", "scary", "shiny", "smoggy", "sparkling", "spotless", "stormy", "strange", "ugly", "unsightly", "unusual"]; | ||
const conditionAdjective = ["alive", "brainy", "broken", "busy", "careful","cautious", "clever", "crazy", "damaged", "dead", "difficult","easy","fake", "false","famous", "forward", "fragile","guilty", "helpful","helpless","important", "impossible","infamous","innocent", "inquisitive", "mad", "modern", "open", "outgoing", "outstanding","poor", "powerful","puzzled", "real", "rich", "right", "robust","sane", "scary", "shy", "sleepy","stupid", "super", "tame", "thick","tired","wild", "wrong"]; | ||
const nounAnimal = ["manatee", "gila monster", "nematode", "seahorse", "slug", "koala bear", "giant tortoise","garden snail", "starfish", "sloth", "american woodcock", "coral", "swallowtail butterfly", "house sparrow", "sea anemone"]; | ||
function randomChoice(array){ | ||
return array[Math.floor(Math.random() * array.length)]; | ||
} | ||
function capitalize(word){ | ||
word = word.replace(/\b\w/g, l => l.toUpperCase()); | ||
return word; | ||
} | ||
let name = randomChoice(appearanceAdjective) + " " + randomChoice(conditionAdjective) + " " + randomChoice(nounAnimal); | ||
name = capitalize(name); | ||
name = name.replace(/ /g, "-"); | ||
return name; | ||
} | ||
export function exportToJSON(vc) { | ||
@@ -77,0 +99,0 @@ console.warn("VideoContext.exportToJSON has been deprecated. Please use VideoContext.snapshot instead."); |
@@ -12,3 +12,3 @@ //Matthew Shotton, R&D User Experience,© BBC 2015 | ||
import VideoElementCache from "./videoelementcache.js"; | ||
import { createSigmaGraphDataFromRenderGraph, visualiseVideoContextTimeline, visualiseVideoContextGraph, createControlFormForNode, UpdateablesManager, exportToJSON, importSimpleEDL, snapshot } from "./utils.js"; | ||
import { createSigmaGraphDataFromRenderGraph, visualiseVideoContextTimeline, visualiseVideoContextGraph, createControlFormForNode, UpdateablesManager, exportToJSON, importSimpleEDL, snapshot, generateRandomId } from "./utils.js"; | ||
import DEFINITIONS from "./Definitions/definitions.js"; | ||
@@ -71,3 +71,13 @@ | ||
// Create a unique ID for this VideoContext which can be used in the debugger. | ||
if(this._canvas.id) { | ||
if (typeof this._canvas.id === "string" || this._canvas.id instanceof String){ | ||
this._id = canvas.id; | ||
} | ||
} | ||
if(this._id === undefined) this._id = generateRandomId(); | ||
if (window.__VIDEOCONTEXT_REFS__ === undefined) window.__VIDEOCONTEXT_REFS__ = {}; | ||
window.__VIDEOCONTEXT_REFS__[this._id] = this; | ||
this._renderGraph = new RenderGraph(); | ||
@@ -98,2 +108,20 @@ this._sourceNodes = []; | ||
/** | ||
* Reurns an ID assigned to the VideoContext instance. This will either be the same id as the underlying canvas element, | ||
* or a uniquley generated one. | ||
*/ | ||
get id(){ | ||
return this._id; | ||
} | ||
/** | ||
* Set the ID of the VideoContext instance. This should be unique. | ||
*/ | ||
set id(newID){ | ||
delete window.__VIDEOCONTEXT_REFS__[this._id]; | ||
if (window.__VIDEOCONTEXT_REFS__[newID] !== undefined) console.warn("Warning; setting id to that of an existing VideoContext instance."); | ||
window.__VIDEOCONTEXT_REFS__[newID] = this; | ||
this._id = newID; | ||
} | ||
/** | ||
* Register a callback to happen at a specific point in time. | ||
@@ -100,0 +128,0 @@ * @param {number} time - the time at which to trigger the callback. |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6322635
21292