taboca / TagVisor

Real-time Animation Enhancements for Existing Web Pages
http://www.taboca.com
10 stars 2 forks source link

Design model and challenges [ux-paper] [ux-priorart] #3

Open taboca opened 10 years ago

taboca commented 10 years ago

Introduction

TagVisor is a choreographer for events of animation and page modification in HTML5. It reads instructions, rules, and dispatch operations, such as animations, in a given HTML page, and its children objects, for example iframes. This library is highly experimental -- use it at your own risk. TagVisor can be used to create live animated experiences out of plain web pages.

Exploration and Paradigm: Compound Event Handlers

For a given document, there is a stack of event handlers associated with input fields. These dispatch new events in the DOM tree, that can be evaluated by a general event handler, that watches certain type of events -- named here a class event. A class event handler, can then check all the values and decide to kick a new, 'compound event', if a desired condition is met based in the input values for the original incoming events. As an example, imagine a voting system web page with many input fields. Each input field stores a numeric value and for each of them, there is an event handler. So, for every value mutation in any given field, a class event is generated. This class event can be watched by another event handler that can check if a given criteria is met, for example, the sum of all the input fields to be greater than value X. Another case is simply generating another event that has the current sum of all the input values.

Proposed features:

High level:

How to map the current code to the new code? For every DOM mutation in the live tree we call a querier. So, for example, if

Being the mutation: is:

Event manager.

The event manager is responsible for watching incoming events in a document tree. It uses the event name and data to find if there is a registered handler, in our case, this is defined by a a selector. When it finds this handler, it should execute the handler's function, which may generate other events. Each event has an unique ID and once processed, they are to be moved to a a data store that represents the history of events.

We can also have more than one event to trigger a handler. This operation is a composition or a compound event - if you think that a new event will be result of multiple incoming events. So, for example, here is one way to implement this:

clock { kick marcio:two; }

marcio { in: one & two; out: marcio2 }

Issues with selectors

Wildcard: in order to make the wild card for ranges of values 
you would need to generate a lot of selectors to the whole range
of possibilities. 

Cases

Main rule for events that can apply to elements ( widgets ) amonng 
all iframes including nested iframes. 

* * 20 load iframe clock

* * 25 #clock zoom 
    internal ( scale ) - insertRule

* * 30 remove clock 

Cases

For each second, we kick a time stamp event
if someone wants to add something to the current t+1
you insert a rule for the t+1. 

Case, a 30 seconds animation that has t=1 E=1 t=10,E2 and t=20, E3
and repeats.

* * 1 E1
* * 10 E2 
* * 20 E3 

time[secs=1] { E1 } time[secs=10] { E2 } time[secs=20] { E3 } 

Each time event that happens in the timeline DOM storage appears and 
goes away, to a history DOM storage, which means processed. 

DailyCron

A heart beat loop ticker system that queries a data set of rules and applies ( generate events )

Temporal Selectors

Date, Time,

time[date="20/08/2011"] { apply-event: }

time[cron="* * *"] { apply-event: }

Mutation Events