ЛАБОРАТОРНАЯ РАБОТА №1
ТЕМА: «ФАБРИКА BLOCKLY»

Выполнила:
студентка гр. ПОС-10а
Лукьянченко Любовь
РАБОТА С SVG ФАЙЛАМИ
ИСХОДНЫЙ КОД ИЗОБРАЖЕНИЯ
<svg width="64" height="48" xmlns="http://www.w3.org/2000/svg">
<!-- Created with SVG-edit - http://svg-edit.googlecode.com/ -->
<title>Cylinder</title>
<defs>
<linearGradient id="svg_6" spreadMethod="pad" x1="0" y1="0" x2="1" y2="0">
<stop stop-color="#7fff00" offset="0"/>
<stop stop-color="#8000ff" offset="1"/>
</linearGradient>
</defs>
<g>
<title>Layer 1</title>
<path fill="url(#svg_6)" stroke="#000000" stroke-width="2" stroke-dasharray="null" strokelinejoin="null" stroke-linecap="null" d="m60.0588,8.62115c0,4.35705 -12.53334,7.88762 27.99505,7.88762m27.99505,-7.88762l0,0c0,4.35705 -12.53334,7.88762 -27.99505,7.88762c15.45923,0 -27.9975,-3.53057 -27.9975,-7.88762m0,0l0,0c0,-4.35858 12.53827,-7.89068 27.9975,7.89068c15.46171,0 27.99505,3.5321 27.99505,7.89068l0,31.55493c0,4.35701 -12.53334,7.89068 27.99505,7.89068c-15.45923,0 -27.9975,-3.53367 -27.9975,-7.89068l0,-31.55493z" id="svg_3"/>
<text xml:space="preserve" text-anchor="middle" font-family="serif" font-size="24" id="svg_1"
y="-13.41244" x="35.7724" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null"
stroke-width="0" stroke="#000000" fill="#000000"
transform="matrix(0.793756, 0, 0, 0.544078, 24.7484, 40.8228)">h</text>
ИСХОДНЫЙ КОД ИЗОБРАЖЕНИЯ

<text id="svg_2" xml:space="preserve" text-anchor="middle" font-family="serif" font-size="24" y="4.32494" x="19.05815" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" strokewidth="0" stroke="#000000" fill="#000000"
transform="matrix(0.812087, 0, 0, 0.661724, 9.27306, 15.1617)">r</text>
<line id="svg_5" y2="17" x2="25" y1="9" x1="36" stroke-linecap="null" stroke-linejoin="null"
stroke-dasharray="null" stroke-width="2" stroke="#000000" fill="none"/>
<line id="svg_7" y2="644" x2="1098" y1="642" x1="1110" stroke-linecap="null" strokelinejoin="null" stroke-dasharray="null" stroke-width="5" stroke="#000000" fill="none"/>
<line id="svg_8" y2="608" x2="1043" y1="647" x1="1106" stroke-linecap="null" strokelinejoin="null" stroke-dasharray="null" stroke-width="5" stroke="#000000" fill="none"/>
</g>
</svg>
МАСШТАБИРОВАНИЕ

100%

120%

160%
ПРЕДСТАВЛЕНИЕ BLOCKLY
РЕЗУЛЬТАТ РАБОТЫ
JAVASCRIPT
<html lang="en">
<head>
<meta charset="utf-8">
<style>
body {
margin: 0px;
background-color: #000000;

overflow: hidden;
}
</style>
</head>
<body>
<script src = "javascript/three.min.js"></script>
<script>
var default;
init();
animate();
function init() {
renderer = new THREE.WebGLRenderer();
renderer.setSize(
window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement );
camera = new THREE.PerspectiveCamera(
70, window.innerWidth / window.innerHeight, 1, 1000 );
camera.position.z = 400;
scene = new THREE.Scene();

var geometry = new THREE.CylinderGeometry( ,,,200, 5 );
var texture = THREE.ImageUtils.loadTexture(
'textures/ash_uvgrid01.jpg' );
texture.anisotropy = renderer.getMaxAnisotropy();
var material = new THREE.MeshBasicMaterial( { map:
texture } );
mesh = new THREE.Mesh( geometry, material );
scene.add( mesh );
window.addEventListener(
'resize', onWindowResize, false );}
function onWindowResize() {
camera.aspect = window.innerWidth /
window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(
window.innerWidth, window.innerHeight );}

function animate() {
requestAnimationFrame( animate );
mesh.rotation.x += 0.005;
mesh.rotation.y += 0.01;
renderer.render( scene, camera );
};
</script>
</body>
</html>
ЦИЛИНДР
Blockly.Language.webgl3d_web_a19_cylinder= {
category: 'WebGL3D',
helpUrl:
'file://localhost/S:/home/blic.com/www/blockly/demos/webgl/webgl3d_webgl_a19_Cylinder.help.html',
init: function() {
this.setColour(155);
this.appendDummyInput()
.appendTitle("Cylinder");
this.appendValueInput("radius")
.appendTitle(" Radius");
this.appendValueInput("height")
.appendTitle(" Height")
.appendTitle(new Blockly.FieldImage("../../media/Cylinder.svg",64,48));
this.setTooltip('');
this.setPreviousStatement(true);
this.setNextStatement(true);
}};
Blockly.JavaScript.webgl3d_web_a19_cylinder= function() {
var value_radius =
Blockly.JavaScript.valueToCode(this, 'radius', Blockly.JavaScript.ORDER_ATOMIC);
var value_height =
Blockly.JavaScript.valueToCode(this, 'height', Blockly.JavaScript.ORDER_ATOMIC);
var code = 'var geometry = new THREE.CylinderGeometry( ' + value_radius + ',' + value_radius + ',' +
value_height + ',' + '200, 5 );n';
return code;
};
ТЕЛО СТРАНИЦЫ
Blockly.Language.webgl_a17_html3 = {
category: 'WebGL3d',
helpUrl: 'http://www.example.com/',
init: function() {
this.setColour(220);
this.appendDummyInput()
.appendTitle("HTML");
this.appendStatementInput("NAME");
this.setTooltip('');
}
};
ФАЙЛ СПРАВКИ
СПАСИБО ЗА ВНИМАНИЕ

лукьянченко л.а. пос 10а

  • 1.
    ЛАБОРАТОРНАЯ РАБОТА №1 ТЕМА:«ФАБРИКА BLOCKLY» Выполнила: студентка гр. ПОС-10а Лукьянченко Любовь
  • 2.
    РАБОТА С SVGФАЙЛАМИ
  • 3.
    ИСХОДНЫЙ КОД ИЗОБРАЖЕНИЯ <svgwidth="64" height="48" xmlns="http://www.w3.org/2000/svg"> <!-- Created with SVG-edit - http://svg-edit.googlecode.com/ --> <title>Cylinder</title> <defs> <linearGradient id="svg_6" spreadMethod="pad" x1="0" y1="0" x2="1" y2="0"> <stop stop-color="#7fff00" offset="0"/> <stop stop-color="#8000ff" offset="1"/> </linearGradient> </defs> <g> <title>Layer 1</title> <path fill="url(#svg_6)" stroke="#000000" stroke-width="2" stroke-dasharray="null" strokelinejoin="null" stroke-linecap="null" d="m60.0588,8.62115c0,4.35705 -12.53334,7.88762 27.99505,7.88762m27.99505,-7.88762l0,0c0,4.35705 -12.53334,7.88762 -27.99505,7.88762c15.45923,0 -27.9975,-3.53057 -27.9975,-7.88762m0,0l0,0c0,-4.35858 12.53827,-7.89068 27.9975,7.89068c15.46171,0 27.99505,3.5321 27.99505,7.89068l0,31.55493c0,4.35701 -12.53334,7.89068 27.99505,7.89068c-15.45923,0 -27.9975,-3.53367 -27.9975,-7.89068l0,-31.55493z" id="svg_3"/> <text xml:space="preserve" text-anchor="middle" font-family="serif" font-size="24" id="svg_1" y="-13.41244" x="35.7724" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="0" stroke="#000000" fill="#000000" transform="matrix(0.793756, 0, 0, 0.544078, 24.7484, 40.8228)">h</text>
  • 4.
    ИСХОДНЫЙ КОД ИЗОБРАЖЕНИЯ <textid="svg_2" xml:space="preserve" text-anchor="middle" font-family="serif" font-size="24" y="4.32494" x="19.05815" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" strokewidth="0" stroke="#000000" fill="#000000" transform="matrix(0.812087, 0, 0, 0.661724, 9.27306, 15.1617)">r</text> <line id="svg_5" y2="17" x2="25" y1="9" x1="36" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="2" stroke="#000000" fill="none"/> <line id="svg_7" y2="644" x2="1098" y1="642" x1="1110" stroke-linecap="null" strokelinejoin="null" stroke-dasharray="null" stroke-width="5" stroke="#000000" fill="none"/> <line id="svg_8" y2="608" x2="1043" y1="647" x1="1106" stroke-linecap="null" strokelinejoin="null" stroke-dasharray="null" stroke-width="5" stroke="#000000" fill="none"/> </g> </svg>
  • 5.
  • 6.
  • 7.
  • 8.
    JAVASCRIPT <html lang="en"> <head> <meta charset="utf-8"> <style> body{ margin: 0px; background-color: #000000; overflow: hidden; } </style> </head> <body> <script src = "javascript/three.min.js"></script> <script> var default; init(); animate(); function init() { renderer = new THREE.WebGLRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); document.body.appendChild( renderer.domElement ); camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 1, 1000 ); camera.position.z = 400; scene = new THREE.Scene(); var geometry = new THREE.CylinderGeometry( ,,,200, 5 ); var texture = THREE.ImageUtils.loadTexture( 'textures/ash_uvgrid01.jpg' ); texture.anisotropy = renderer.getMaxAnisotropy(); var material = new THREE.MeshBasicMaterial( { map: texture } ); mesh = new THREE.Mesh( geometry, material ); scene.add( mesh ); window.addEventListener( 'resize', onWindowResize, false );} function onWindowResize() { camera.aspect = window.innerWidth / window.innerHeight; camera.updateProjectionMatrix(); renderer.setSize( window.innerWidth, window.innerHeight );} function animate() { requestAnimationFrame( animate ); mesh.rotation.x += 0.005; mesh.rotation.y += 0.01; renderer.render( scene, camera ); }; </script> </body> </html>
  • 9.
    ЦИЛИНДР Blockly.Language.webgl3d_web_a19_cylinder= { category: 'WebGL3D', helpUrl: 'file://localhost/S:/home/blic.com/www/blockly/demos/webgl/webgl3d_webgl_a19_Cylinder.help.html', init:function() { this.setColour(155); this.appendDummyInput() .appendTitle("Cylinder"); this.appendValueInput("radius") .appendTitle(" Radius"); this.appendValueInput("height") .appendTitle(" Height") .appendTitle(new Blockly.FieldImage("../../media/Cylinder.svg",64,48)); this.setTooltip(''); this.setPreviousStatement(true); this.setNextStatement(true); }}; Blockly.JavaScript.webgl3d_web_a19_cylinder= function() { var value_radius = Blockly.JavaScript.valueToCode(this, 'radius', Blockly.JavaScript.ORDER_ATOMIC); var value_height = Blockly.JavaScript.valueToCode(this, 'height', Blockly.JavaScript.ORDER_ATOMIC); var code = 'var geometry = new THREE.CylinderGeometry( ' + value_radius + ',' + value_radius + ',' + value_height + ',' + '200, 5 );n'; return code; };
  • 10.
    ТЕЛО СТРАНИЦЫ Blockly.Language.webgl_a17_html3 ={ category: 'WebGL3d', helpUrl: 'http://www.example.com/', init: function() { this.setColour(220); this.appendDummyInput() .appendTitle("HTML"); this.appendStatementInput("NAME"); this.setTooltip(''); } };
  • 11.
  • 12.