Ignore:
Timestamp:
2015-02-09T09:51:09+13:00 (9 years ago)
Author:
bmt11
Message:

Added Tooltip for slider need to rework so that it doesnt overlay

Location:
other-projects/nz-flag-design/trunk/render-3d
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • other-projects/nz-flag-design/trunk/render-3d/CSS/slider.css

    r29694 r29719  
    4343    outline: 0;
    4444}
     45.tooltip {
     46    position: absolute;
     47    z-index: 1020;
     48    display: block;
     49    padding: 5px;
     50    font-size: 11px;
     51    visibility: visible;
     52    margin-top: -2px;
     53    bottom:120%;
     54    margin-left: -2em;
     55}
     56
     57.tooltip .tooltip-arrow {
     58    bottom: 0;
     59    left: 50%;
     60    margin-left: -5px;
     61    border-top: 5px solid #000000;
     62    border-right: 5px solid transparent;
     63    border-left: 5px solid transparent;
     64    position: absolute;
     65    width: 0;
     66    height: 0;
     67}
  • other-projects/nz-flag-design/trunk/render-3d/Flag_files/slider.js

    r29694 r29719  
    11jQuery(document).ready(function ($) {
     2   
     3    var initialValue = 100;
     4    var curValue = initialValue;
     5    var tooltip = 'Wind Speed: '+curValue+'';
     6   
    27    $("#speed").slider({
    38        min: 25,
    49        max: 300,
    5         value: 100,
     10        value: initialValue,
    611        animate: true,
    712        range: 'min',
     13        create: function(event, ui) {
     14            initTooltip(ui);
     15        },
    816        slide: function(event, ui) {
    9             setSpeed(ui.value);
     17            setSpeed(ui);
    1018        }
    1119    });
     20   
     21    function initTooltip(ui){
     22        tooltip = 'Wind Speed: '+curValue+'';
     23        var target = ui.handle || $('.ui-slider-handle'); 
     24        $(target).html(tooltip);
     25    }
     26   
     27    function setSpeed(ui){
     28        windStrength = ui.value;
     29        curValue = ui.value;
     30        tooltip = 'Wind Speed: '+curValue+'';
     31        target = ui.handle || $('.ui-slider-handle');
     32        $(target).html(tooltip);       
     33    }
    1234   
    1335    $(".ui-slider").mouseenter(function(){
     
    1840        controls.enabled = true;
    1941    });
    20    
    21     function setSpeed(speed){
    22         windStrength = speed;
    23     }
     42
    2443});
  • other-projects/nz-flag-design/trunk/render-3d/flag.html

    r29696 r29719  
    180180        <script type="text/javascript">
    181181            var keyboard = new KeyboardState();
    182             var clothTextures = [];
     182            var clothTexture;
    183183
    184184            var initial = true;
     
    227227            // array for holding existing flags
    228228           
    229             var flags = ["./images/flag.png", "./images/flag2.png", "./images/canada.png"];
     229            var flag = "./images/flag.png";//, "./images/flag2.png", "./images/canada.png"];
    230230            var flagSelector = 0;
    231231            var materials;
     
    305305                var session_id = $.cookie('JSESSIONID');
    306306                if (session_id) {
    307                   flags[0] = "images/flag-" + session_id + ".png";
     307                  flag = "images/flag-" + session_id + ".png";
    308308                }
    309309
    310310                // load flag textures
    311                 var i;
    312                
    313                 for(i = 0; i < flags.length; i++){
    314                     clothTextures[i] = THREE.ImageUtils.loadTexture( flags[i] );
    315                     //clothTextures[i].needsUpdate = true;
    316                     clothTextures[i].wrapS = clothTextures[i].wrapT = THREE.ClampToEdgeWrapping;
    317                     clothTextures[i].anisotropy = 16;
    318                 }
     311               
     312                clothTexture = THREE.ImageUtils.loadTexture( flag );
     313                clothTexture.wrapS = clothTexture.wrapT = THREE.ClampToEdgeWrapping;
     314                clothTexture.anisotropy = 16;
    319315                createFlag();
    320316               
     
    418414            function createFlag(flagFilename) {
    419415                    if (flagFilename) {
    420                     flags[0] = "./images/" + flagFilename;
     416                    flag = "./images/" + flagFilename;
    421417                }
    422418   
     
    425421                    // create materials
    426422                    materials = [
    427                         new THREE.MeshLambertMaterial( {specular: 0x030303, fog: false, emissive: 0x111111, shininess: 10, map: clothTextures[0], side: THREE.DoubleSide } ),
     423                        new THREE.MeshLambertMaterial( {specular: 0x030303, fog: false, emissive: 0x111111, shininess: 10, map: clothTexture, side: THREE.DoubleSide } ),
    428424                    ];
    429425                   
     
    434430                    clothGeometry.computeFaceNormals();
    435431
    436                     uniforms = { texture:  { type: "t", value: 0, texture: clothTextures[0] } };
     432                    uniforms = { texture:  { type: "t", value: 0, texture: clothTexture } };
    437433                    vertexShader = document.getElementById( 'vertexShaderDepth' ).textContent;
    438434                    fragmentShader = document.getElementById( 'fragmentShaderDepth' ).textContent; 
     
    454450               
    455451                }else{
    456                     clothTextures[flagSelector] = THREE.ImageUtils.loadTexture( flags[flagSelector]+'?'+Date.now() );
    457                     object.material.map = clothTextures[flagSelector];
     452                    clothTexture = THREE.ImageUtils.loadTexture( flag+'?'+Date.now() );
     453                    object.material.map = clothTexture;
    458454                    object.material.needsUpdate = true;
    459455                }
  • other-projects/nz-flag-design/trunk/render-3d/weather/rain.js

    r29694 r29719  
    3939            // create a velocity vector
    4040            this.particle.velocity = new THREE.Vector3(
    41                 (windForce.x * this.MASS), // x
     41                (windForce.x * (1-this.MASS)), // x
    4242                -Math.random() * 0.01, // y
    43                 (windForce.z * this.MASS)); // z
     43                (windForce.z * (1-this.MASS))); // z
    4444
    4545            // add it to the geometry
     
    7676                this.particle.x = (Math.random() * 10000) - 5000;
    7777                this.particle.z = (Math.random() * 10000) - 5000;
    78 
    7978            }
    8079           
    8180            // update the velocity
    8281            this.particle.velocity.y -= Math.random() * 0.01;
     82            this.particle.velocity.x = windForce.x * (1-this.MASS);
     83            this.particle.velocity.z = windForce.z * (1-this.MASS)
    8384           
    8485            // and the position
Note: See TracChangeset for help on using the changeset viewer.