5种php生成swf 文件代码
5种php教程生成swf 文件代码
/*
下面这几款php生成flash文件代码,是从简单的生成swf文件到生成 flash动画文件等,每个实例都是经典的。
*/
//首先开启php扩展php_ming
$f = new swffont( '_sans' );
$t = new swftextfield();
$t->setfont( $f );
$t->setcolor( 0, 0, 0 );
$t->setheight( 400 );
$t->addstring( 'hello world' );
$m = new swfmovie();
$m->setdimension( 2500, 800 );
$m->add( $t );
$m->save( 'hello.swf' );
?>
******************************************************************************
例二:让文本动起来text.php
$f = new swffont( '_sans' );
$pt = new swftextfield();
$pt->setfont( $f );
$pt->setcolor( 0, 0, 0 );
$pt->setheight( 400 );
$pt->addstring( '1000' );
$tt = new swftextfield();
$tt->setfont( $f );
$tt->setcolor( 192, 192, 192, 90 );
$tt->setheight( 350 );
$tt->addstring( 'points' );
$m = new swfmovie();
$m->setdimension( 2500, 800 );
$pts = $m->add( $pt );
$pts->moveto( 0, 0 );
$tts = $m->add( $tt );
$tts->moveto( 1300, 200 );
for( $i = 0; $i $m->nextframe();
$pts->scaleto( 1.0 + ( $i / 10.0 ), 1.0 + ( $i / 10.0 ) );
}
$m->save( 'text.swf' );
?>
*****************************************************************************
例三:绘制一些图形 绘制简单的直线 line.php
$m = new swfmovie();
$m->setdimension( 300, 300 );
$s = new swfshape();
$s->setline( 10, 0, 0, 0 );
$s->movepento( 10, 10 );
$s->drawlineto( 290, 290 );
$m->add( $s );
$m->save( 'line.swf' );
?>
******************************************************************************
例四:旋转直线
$m = new swfmovie();
$m->setdimension( 300, 300 );
$s = new swfshape();
$s->setline( 5, 0, 0, 0 );
$s->movepento( -100, -100 );
$s->drawlineto( 100, 100 );
$ts = $m->add( $s );
$ts->moveto( 150, 150 );
for( $i = 0; $i $ts->rotate( 10 );
$m->nextframe();
}
$m->save( 'rotate.swf' );
?>
***************************************************************************
例五:
使用图片
文本和诸如直线、圆、弧、曲线和矩形之类的简单矢量图形都是十分优秀的,但在理想的情况下,您必须能访问这些 flash 动画中的图片。值得庆幸的是,ming 库使您可以轻松的使用图片,如下所示
$img = new swfbitmap( file_get_contents( 'megan.jpg' ) );
$s = new swfshape();
$imgf = $s->addfill( $img );
$s->setrightfill( $imgf );
$s->movepento( 0, 0 );
$s->drawlineto( $img->getwidth(), 0 );
$s->drawlineto( $img->getwidth(), $img->getheight() );
$s->drawlineto( 0, $img->getheight() );
$s->drawlineto( 0, 0 );
$m = new swfmovie();
$m->setdimension( $img->getwidth() * 2, $img->getheight() * 2 );
$is = $m->add( $s );
$is->moveto( $img->getwidth() / 2, $img->getheight() / 2 );
for( $i = 0; $i {
$is->skewx( 0.02 );
$is->skewy( -0.03 );
$m->nextframe();
}
$m->save( 'image.swf' );

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

If you are an experienced PHP developer, you might have the feeling that you’ve been there and done that already.You have developed a significant number of applications, debugged millions of lines of code, and tweaked a bunch of scripts to achieve op

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

A string is a sequence of characters, including letters, numbers, and symbols. This tutorial will learn how to calculate the number of vowels in a given string in PHP using different methods. The vowels in English are a, e, i, o, u, and they can be uppercase or lowercase. What is a vowel? Vowels are alphabetic characters that represent a specific pronunciation. There are five vowels in English, including uppercase and lowercase: a, e, i, o, u Example 1 Input: String = "Tutorialspoint" Output: 6 explain The vowels in the string "Tutorialspoint" are u, o, i, a, o, i. There are 6 yuan in total

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

What are the magic methods of PHP? PHP's magic methods include: 1.\_\_construct, used to initialize objects; 2.\_\_destruct, used to clean up resources; 3.\_\_call, handle non-existent method calls; 4.\_\_get, implement dynamic attribute access; 5.\_\_set, implement dynamic attribute settings. These methods are automatically called in certain situations, improving code flexibility and efficiency.
