<commit_before><commit_msg>source/_posts/2012-01-14-dom-events-in-3d-space.markdown begining of a new post<commit_after>---
layout: post
title: "Dom Events in 3D Space"
date: 2012-01-14 11:56
comments: true
categories: 
---

* this post present an experiment on pushing the concept of dom events
in 3D Space.
* three.js already had the ability to interact with the mouse.
* You can see it in action
[here](http://mrdoob.github.com/three.js/examples/webgl_interactive_cubes.html)
and
[here](http://mrdoob.github.com/three.js/examples/webgl_interactive_voxelpainter.html).


* Internally it uses
[THREE.Projector](https://github.com/mrdoob/three.js/blob/master/src/core/Projector.js)
and
[THREE.Ray](https://github.com/mrdoob/three.js/blob/master/src/core/Ray.js).

* We present an higher level api on top of those functions.
* something closer to the usual web developper
* an interface which mimic dom events

```javascript
    mesh.on('click', function()({
        mesh.scale.x *= 2;
    }))
```

What this line is doing ? It double scale.x when you click on the mesh.


# list of bound events
  * click
  * mouseup
  * mousedown
  * mouseenter
  * mouseleave


# Meta
* docco comment for both threex 
{'fraction_non_alphanumeric': 0.11896838602329451, 'fraction_numerical': 0.019966722129783693, 'mean_word_length': 3.8313253012048194, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3136182', 'n_tokens_mistral': 427, 'n_tokens_neox': 398, 'n_words': 118}